如何获取当前和随机打开的doucument(应用程序)文件名的名称 [英] How to get name of currenly and randomly open doucument(application) file name

查看:89
本文介绍了如何获取当前和随机打开的doucument(应用程序)文件名的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们!!

我是C#的初学者。

我正在开发Password Pro应用程序,因为我想自动检测当前打开的文件应用程序的密码访问数据库文件。

一般来说,我们已经将数据保存在受密码保护的文件中,例如docx,xl​​s,pdf等。

我想申请这样的话,当我特意穿上时密码保护文件密码从数据库中检测到并简单地显示给用户。



我已经捕获了当前打开的窗口的标题,即输入密码窗口,这是一个孩子任何应用程序的窗口,如docx,pdf等。

但我想要文件的标题,即当前打开的应用程序的文件名。

例如demo.pdf,op .docx等

当我点击说demo.pdf我想要这个demo.pdf(文件名)



请任何人帮助我并给我一些代码,这些代码需要获得当前打开的文档ation filename。

Hi Friends!!
I am beginer to C#.
I am developing Password Pro application in that i want to automatically detect the password of currently opened file application from access database file .
Generally we have secured our data in password protected file say docx, xls, pdf etc.
I want to make application such that when i cliked on particular password protected file the password gets detected from database and simply shown to user.

I have captured the title of currently opened window i.e. "Enter the password" window which is child window of any application like docx, pdf etc.
But I want to need the title of file i.e. file name of currently opened application.
for example demo.pdf, op.docx etc.
when i clicked on say demo.pdf i want to need this demo.pdf(file name)

Please anybody help me and give me code that are need for getting this currently opened document application filename.

推荐答案

可能你想做的事情在很多(如果不是大多数)情况下都不起作用。



首先,你不能依赖包含文件名的父窗口标题 - 它可能,但它可能只包含正确输入密码后的文件名,而不是之前。

其次,父标题可能不包含扩展名,并且通常不包含路径,因此您可以获取文件名,但不知道它是哪一个,或者它在哪里。

第三,你甚至不能依赖打开的文件句柄,因为大多数现代程序打开文件,读取文件并再次关闭它 - 如果只是因为它几乎不会导致备份中断程式。因此,当显示输入密码对话框时,文件不会打开。



说实话,我想你会发现即使是一个组合方法会给你不好的结果,并建议你重新考虑你的应用程序。这可能会给你带来更多的麻烦。
Probably, what you want to do will not work in many (if not most) cases.

For one thing, you can''t rely on a parent window title containing the file name - it may, but it may only contain the file name after the password has been correctly entered and not before.
Secondly, the parent title may not contain the extension, and very often does not contain a path, so you may be able to get the file name, but have no idea which one it is, or where it is.
Thirdly, you can''t even rely on open file handles, because most modern programs open the file, read it, and close it again - if only so that it causes little or no interruption for backup programs. so the file won''t be open when the "enter password" dialog is showing.

To be honest, I think you are going to find that even a combination of methods is going to give you poor results and would suggest that you re-think your application. This is likely to give you more trouble that it is worth.


这篇关于如何获取当前和随机打开的doucument(应用程序)文件名的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆