VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code locks the files which are desired to be.These files can be unlocked whenever desired.This

by Vishal V. Kulkarni (6 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 16th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code locks the files which are desired to be.These files can be unlocked whenever desired.This is a real good api and helps to lock the

API Declarations


'In case if you need any help of security of files
'please contact [email protected]

Option Explicit
Private Const OPEN_EXISTING = 3
Private Const PATH_FILE = "C:\WINNT\Profiles\vishal\Desktop\newnewRegistry.doc"
Private Declare Function CreateFile Lib "kernel32" _
Alias "CreateFileA" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Rate This code locks the files which are desired to be.These files can be unlocked whenever desired.This



         Dim lk             As Long
         Dim lLng           As Long
         hFileHandle = CreateFile(PATH_FILE, 3, 0&, 0&, OPEN_EXISTING, 0&, 0&)
         lk = LockFile(hFileHandle, 1, 1, 1024, 1024)
         MsgBox "Press ok to read the file", vbInformation
         CloseHandle (hFileHandle)




Download this snippet    Add to My Saved Code

This code locks the files which are desired to be.These files can be unlocked whenever desired.This Comments

No comments have been posted about This code locks the files which are desired to be.These files can be unlocked whenever desired.This. Why not be the first to post a comment about This code locks the files which are desired to be.These files can be unlocked whenever desired.This.

Post your comment

Subject:
Message:
0/1000 characters