-
Setting access privilages to a shared folder through coding??
Hi,
How do I set access privilages to a shared folder through coding and make the folder accessible only by my code....
For ex: "Test" folder is a network share. can i make this folder accessed only by my program but not by any other user??
Rgds,
Prithvi
Last edited by Prithvirajck; 04-19-2007 at 05:20 AM.
Reason: Setting access privilages to a shared folder through coding??
-
AFAIK the permissions in Windows are set by user, not by application.
single files can be locked by an application, but I do not know about folders.
maybe if we give us more details there can be alternatives
"There are two ways to write error-free programs. Only the third one works."
Unknown
-
Marco is correct: you cannot grant permissions to an application, only to a user account. You could create a user account to be used only by your application. Grant the account permission to the shared folder, then use Windows API functions to have your application access the folder as that user. See http://support.microsoft.com/kb/q173011/ for more information.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Can guide me how single files can be locked by an application??
For ex: take CSV file.
Thanks & Regards,
Prithvi
http://www.prithvi.tk
Last edited by Prithvirajck; 04-20-2007 at 05:45 AM.
-
you can use the LockFile API, but in VB I strongly do NOT recommend it, it is much better to use the locking mechanism of the Open statement
http://msdn2.microsoft.com/en-us/lib...77(vs.60).aspx
Use:
Open myFile For ... Access ... Lock Read Write as #file
and specify in the dots the way you want to open the file
BTW your problem is very common, thus you can find a lot of third party components that allows you to crypt/decrypt entire folders, that you can open from your app with a password. But for that, I am sorry I do not have any suggestion because I never used any of them.
"There are two ways to write error-free programs. Only the third one works."
Unknown
-
The following is the code, which ll take the first line of the "ManipulateCSV.txt" and split the words seperated by commas and pastes one by one in "strOPFile.txt".
Code:
Option Explicit
Sub main()
Dim strCurrentPath
Dim strLine, i, LowerVal, UpperVal
Dim Temp$
Dim strValues
Dim fn As Integer
strCurrentPath = App.Path
Temp$ = Dir(strCurrentPath & "\ManipulateCSV.txt")
fn = FreeFile
Do While Temp$ <> ""
Open strCurrentPath & "\ManipulateCSV.txt" For Input Access Read Lock Read Write As #fn
Do While Not EOF(fn)
Line Input #fn, strLine
Loop
Close #fn
strValues = Split(strLine, ",", -1, 1)
LowerVal = LBound(strValues)
UpperVal = UBound(strValues)
Open strCurrentPath & "\strOpFile.txt" For Output Access Write Lock Read Write As #fn
For i = LowerVal To UpperVal
Write #fn, strValues(i)
Next
Close #fn
Temp$ = Dir
Loop
End Sub
Now I or using another program being able to manipulate the above shown txt files. Is it possible to block these txt files from being manipulated by me or another program, exept for the above code??
Thanks & Regards,
Prithvi
Similar Threads
-
Replies: 1
Last Post: 09-06-2002, 06:45 PM
-
Replies: 1
Last Post: 09-06-2002, 06:45 PM
-
By Michelle in forum VB Classic
Replies: 8
Last Post: 04-19-2002, 05:01 PM
-
By Bill Goodland in forum VB Classic
Replies: 2
Last Post: 02-09-2001, 09:24 PM
-
By Bruno Baker in forum VB Classic
Replies: 0
Last Post: 08-17-2000, 03:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|