neltan
asked on
Checking a folder all the time
I would like to make a program always checking a folder in server. If someone write a file into the folder, it would cut & paste to another folder immediately.
I've heard that using a service to run the job when server starts. Is that right? How to do? Any other suggestion?
I've heard that using a service to run the job when server starts. Is that right? How to do? Any other suggestion?
ASKER
Would you please explain your program briefly? I cannot understand.
ASKER
Or How can I create a exe or dll which will be run by service?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you everyone!
Here is a starter sample for the findfirstchangenotificatio
Private Const FILE_NOTIFY_CHANGE_ATTRIBU
Private Const FILE_NOTIFY_CHANGE_DIR_NAM
Private Const FILE_NOTIFY_CHANGE_FILE_NA
Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
Private Const FILE_NOTIFY_CHANGE_LAST_WR
Private Const FILE_NOTIFY_CHANGE_SECURIT
Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
Private Declare Function FindFirstChangeNotificatio
Private Declare Function FindCloseChangeNotificatio
Private Declare Function FindNextChangeNotification
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Ret As Long
'Set the notification hook
Ret = FindFirstChangeNotificatio
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the first time"
'Reactivate our hook
FindNextChangeNotification
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the second time"
'Remove our hook
FindCloseChangeNotificatio
End Sub
You will need to modify this to copy the referenced file using its file handle.