![[delphi编程]如何实现监视指定文件夹的文件 *** 作,第1张 [delphi编程]如何实现监视指定文件夹的文件 *** 作,第1张](/aiimages/%5Bdelphi%E7%BC%96%E7%A8%8B%5D%E5%A6%82%E4%BD%95%E5%AE%9E%E7%8E%B0%E7%9B%91%E8%A7%86%E6%8C%87%E5%AE%9A%E6%96%87%E4%BB%B6%E5%A4%B9%E7%9A%84%E6%96%87%E4%BB%B6%E6%93%8D%E4%BD%9C.png)
ShellAPI
ShellExecute(Handle,'open','Explorer.exe','C:\Windows',nil,1)
这样可以打开C:\蔽樱枝Windows,如果需要其它目录的话,可以自宏敏己设置一下就行颂雹了。
delphi 的samples 不是 用 TShellChangeNotifier控件 吗
object ShellChangeNotifier1: TShellChangeNotifier
NotifyFilters = [nfFileNameChange, nfDirNameChange, nfAttributeChange, nfSizeChange, nfWriteChange, nfSecurityChange]
Root = 'C:\'
WatchSubTree = True
Left = 224
Top = 216
end
你需要先进旅裤行监视。SHNotify_Register(self.Handle)//注册Shell监哪唯视李镇培procedure TForm1.WMShellReg(var Message: TMessage)
var
strPath1, strPath2: string
charPath: array[0..259] of char
pidlItem: PSHNOTIFYSTRUCT
begin
pidlItem := PSHNOTIFYSTRUCT(Message.wParam)
//获得系统消息相关得路径
SHGetPathFromIDList(pidlItem.dwItem1, charPath)
strPath1 := charPath
SHGetPathFromIDList(pidlItem.dwItem2, charPath)
strPath2 := charPath
Memo1.Lines.Add(SHEvEntName(strPath1, strPath2, Message.lParam) + chr(13) + chr(10))
end
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)