捕获记事本信号 [英] trapping notepad signals
本文介绍了捕获记事本信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在Windows Service应用程序中捕获记事本保存和关闭信号吗?
有人可以帮我吗?
等待答复......
i want to know how to trap a notepad save and close signals in a windows service application?
can anybody help me?
waiting for reply......
推荐答案
记事本不发送信号. :-)
关闭操作对文件完全不执行任何操作,因此没有任何陷阱.保存文件的事件可以被捕获和处理.为此,可以使用类System.IO.FileSystemWatcher
.但是,该事件不会告诉您哪个应用程序保存了该文件,但是我非常确定这对您来说没有关系.任何编辑器或其他应用程序保存的更改都很重要,对吗?
只是一个注意事项:记事本并没有增加太多的关注.但是捕获文件系统更改的事件可能会很有用.
—SA
Notepad does not send signals. :-)
Close operation does not do anything at all with the file, so there is nothing to trap. The event of saving a file can be captured and handled. For this purpose, you can use the classSystem.IO.FileSystemWatcher
. However, the event won''t tell you which application saved the file, but I''m pretty much sure it does not matter for you. A change saved by any editor or other application matters, is that right?
Just a note: Notepad does not worse so much attention. But capturing the events of file system changes can be useful.
—SA
除了SA的解决方案外,还有关于FileSystemWatcher
的精彩文章.
FileSystemWatcher-纯混沌(第1部分,共2部分) [
In addition to SA''s solution, There''s a great article aboutFileSystemWatcher
.
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^]
这篇关于捕获记事本信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文