Dear ,
I want to hook a folder to know its activity like folder /file creation or deletion in it. When a file or folder created i recieve a message.
Also I want to know which folder is open in my computer (Explorer). I want it's full path.
Dear ,
I want to hook a folder to know its activity like folder /file creation or deletion in it. When a file or folder created i recieve a message.
Also I want to know which folder is open in my computer (Explorer). I want it's full path.
Strange !
Not a single one here doesnot know my answer
Really Strange
This page should give you some ideas
http://www.systeminternals.com/ntw2k.../filemon.shtml
About 2 years ago I spent 3 months trying to get Windows Explorer to tell me what folder and file it had selected.
I couldn't find a way to do it (which doesn't mean that it can't be done, but I couldn't find a way).
Instead I had to implement right click / right click and Send To / drag and drop from WinExp to my application to allow my app to know which file was selected.
Just as we have Keyboard hook and message hook, well do we
have a folder or file hook?
I'm not so good in system hooking but speaking of message hook
perhaps u should monitor for messages regarding file and folder
manipulation?
VxDs!!!Quote:
Quoted by Sysinternals
For the Windows 9x driver, the heart of Filemon is in the virtual device driver, Filevxd.vxd. It is dynamically loaded, and in its initialization it installs a file system filter via the VxD service, IFSMGR_InstallFileSystemApiHook, to insert itself onto the call chain of all file system requests. On Windows NT the heart of Filemon is a file system driver that creates and attaches filter device objects to target file system device objects so that Filemon will see all IRPs and FastIO requests directed at drives.
When Filemon sees an open, create or close call, it updates an internal hash table that serves as the mapping between internal file handles and file path names. Whenever it sees calls that are handle based, it looks up the handle in the hash table to obtain the full name for display. If a handle-based access references a file opened before Filemon started, Filemon will fail to find the mapping in its hash table and will simply present the handle's value instead.
It's possible, FindFirstChangeNotification API calls handles this, however, it would most likely need to be run as a seperate thread, so it wouldn't halt execution of your VB program. If you're using VB.NET, you could create another thread to do this... for VB6 perhaps you could incorporate the code in the first example into a DLL.... at least I think it has to be run in a seperate thread...
http://msdn.microsoft.com/library/de...ctory_tree.asp
http://msdn.microsoft.com/library/de...tification.asp
yea nemaroller I've used that method b4 but frankly even if the
folder I'm monitoring doesn't change it still keep on buzz me with
the notification.
So since u mentioned running in another thread perhaps this
will help me a bit, perhaps not(VB unstable during Multi-
Threading) haha :D:D
I would guess it had to do with the flag you used.... perhaps FILE_NOTIFY_CHANGE_ATTRIBUTES or FILE_NOTIFY_CHANGE_SIZE or FILE_NOTIFY_CHANGE_LAST_WRITE , any change in any of these would fire it off....
Now, I haven't had a need to use the functions so I can't tell you exactly how I would do it... but then you must also consider
FndNextChangeNotification
ok nemaroller, I went to Microsoft MSDN site and convert the
C++ codes to VB codes, and I've attached the VB src codes.
It's quite a complete file monitor.
BTW, anyone knows how to get the filename(s) or foldername(s)
involved when such file changing event occured?
Holy Crap good job...!!!!! I'm adding this one to my library... again, excellent...
Thanks a lot jian. A great done!