-
November 10th, 2010, 01:28 AM
#1
Lock And Unlock multiple Directories
Hi friends i need your help, please! im trying to lock and unlock multiple directories (folders) (im creating a folder lock), I can block many folders but only unlock one, when trying to unlock another one vb6 tells me: err 75. I understand that this happens because it's saving or creating the file in only one registry location and need store in a Collection list, but i dont know how (i have no idea). I use this code:
Private Const FILE_LIST_DIRECTORY = &H1
Private Const FILE_SHARE_READ = &H1&
Private Const FILE_SHARE_DELETE = &H4&
Private Const OPEN_EXISTING = 3
Private Const FILE_FLAG_BACKUP_SEMANTICS = &H2000000
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal PassZero As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal PassZero As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Dim File_Share_Flag As Long
Dim hDir As Long
Private Sub mnublock_Click()
'Block code
Dim PathDir As String
PathDir = itemData + Ext
hDir = CreateFile(PathDir, FILE_LIST_DIRECTORY, File_Share_Flag, _
ByVal 0&, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, ByVal 0&)
End Sub
Private Sub mnuUnblock_Click()
'Unblock code
CloseHandle hDir
End Sub
* Note: itemData read a .ini file, the .ini values are set in a Listbox, some like this:
itemData = ReadINI("My files protected", "File" & CStr(Counter), iniPath & "data.ini")
The problem is when try unlock all the previous locked folders, only one can be unlocked
thanks a lot for the help And sorry for my poor English
-
November 10th, 2010, 01:49 PM
#2
Re: Lock And Unlock multiple Directories
Convert the FILE LIST and process one at a time. Unless the * flag will work
Tags for this Thread
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
|
Click Here to Expand Forum to Full Width
|