用vb怎么实现文件的实时监控呢?
例如: 在电脑上删除文件,打开文件,复制文件,粘贴文件,的操做,提示出那个盘下的文件被操作(删除文件操做,打开文件操做,复制文件操做,粘贴文件操做)操做的文件名什么(完整的路径),陈辉老师帮我解决一下,请大家帮忙解决伊下?也可以给我发邮箱[email protected]
例如: 在电脑上删除文件,打开文件,复制文件,粘贴文件,的操做,提示出那个盘下的文件被操作(删除文件操做,打开文件操做,复制文件操做,粘贴文件操做)操做的文件名什么(完整的路径),陈辉老师帮我解决一下,请大家帮忙解决伊下?也可以给我发邮箱[email protected]
这个可以完成你的需要
其实你只要不怕累在google里搜索一下,N多实例就出来了
我之所以在回答问题的时候很少贴出源码,是想让提问者有个过程,有个熟悉掌握的阶段这样下次再遇到这样的情况的时候
不会又来一次,能够自己独立的解决问题,
2 网上随便搜搜就有,我找到9,960个网页。
太长了它不让我发!
(ByVal hWnd As Long, _
ByVal uFlags As SHCN_ItemFlags, _
ByVal dwEventID As SHCN_EventIDs, _
ByVal uMsg As Long, _
ByVal cItems As Long, _
lpps As PIDLSTRUCT) As Long' hWnd - Handle of the window to receive the window message specified in uMsg.' uFlags - Flag that indicates the meaning of the dwItem1 and dwItem2 members of the
' SHNOTIFYSTRUCT (which is pointed to by the window procedure's wParam
' value when the specifed window message is received). This parameter can
' be one of the SHCN_ItemFlags enum values below.
' This interpretaion may be inaccurate as it appears pdils are almost alway returned
' in the SHNOTIFYSTRUCT. See James' site for more info...' dwEventId - Combination of SHCN_EventIDs enum values that specifies what events the
' specified window will be notified of. See below.
' uMsg - Window message to be used to identify receipt of a shell change notification.
' The message should *not* be a value that lies within the specifed window's
' message range ( i.e. BM_ messages for a button window) or that window may
' not receive all (if not any) notifications sent by the shell!!!' cItems - Count of PIDLSTRUCT structures in the array pointed to by the lpps param.' lpps - Pointer to an array of PIDLSTRUCT structures indicating what folder(s) to monitor
' changes in, and whether to watch the specified folder's subfolder.参考偶的http://blog.csdn.net/barenx/archive/2008/03/29/2228845.aspx
里面详细的源代码,有注释不过是E文
监视就用ReadDirectoryChangesW吧,监控。。用vc写个驱动也许是个不错的选择