获取当前活动窗口的文件名

发布于 2024-08-04 22:03:36 字数 83 浏览 2 评论 0原文

当某些对话框(如“另存为”、“打开”或“打印”等)打开时,我试图获取 Word 文档或任何其他窗口的文件名。谁能给我一个如何在 C# 中实现这个的例子。

I am trying to get the filename of a word document or any other window for that matter while some dialog box like Save as or Open or Print etc. is open. Can anybody give me an example of how to implement this in C#.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

得不到的就毁灭 2024-08-11 22:03:36

Windows API 可以为您提供占据特定窗口的应用程序的名称,但是要知道该应用程序中打开了哪些文件(或多个文件),则需要 OLE 自动化或应用程序提供的其他一些 API(这里是 winword.exe) 本身。

Windows API can give you the name of the application which occupies a particular window, but to know what file (or files) are open within that application would require OLE automation or some other API supplied by the application (here winword.exe) itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文