VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



With this code you can create a application that watches specified folders. When someone try's to a

by Shayne Cairns (5 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 24th August 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

With this code you can create a application that watches specified folders. When someone try's to access a folder that is being watched, the

API Declarations


'that was'nt important
'Copy the following in to a module.

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060

'----------------------------------

Public Sub sFolderGuard(ByVal sWindow As String)
Dim sReadMessage As String

hWndX = FindWindow(vbNullString, sWindow)
sCloseWindow = SendMessage(hWndX, WM_SYSCOMMAND, SC_CLOSE, NILL)

If FindWindow(vbNullString, sWindow) Then

MsgBox "Message",vbCritical,"Title"
Exit Sub

End If

End Sub

Rate With this code you can create a application that watches specified folders. When someone try's to a




        sFolderGuard "x" 'Where x is the name of the folder to watch

'For any comments, help or more detailed examples email me at [email protected]

Download this snippet    Add to My Saved Code

With this code you can create a application that watches specified folders. When someone try's to a Comments

No comments have been posted about With this code you can create a application that watches specified folders. When someone try's to a. Why not be the first to post a comment about With this code you can create a application that watches specified folders. When someone try's to a.

Post your comment

Subject:
Message:
0/1000 characters