单击鼠标获取文件路径名 [英] Obtain file path name on mouse click
本文介绍了单击鼠标获取文件路径名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
是否可以使用鼠标单击来获取完整的路径名,即当我单击c:\上的说file.txt的文件时,我将得到的结果为c:\ file.txt.除鼠标单击以外,其他任何获取文件名的方式.
请帮助我震惊....
谢谢
Hello everyone
Is it possible to obtain complete path name using mouse click i.e when i click on a file say file.txt on c:\ i shld get the result as c:\file.txt. Any other ways of getting file name other than mouse click.
Please help i am struck with this ....
thank you
推荐答案
谢谢....另一个疑问...是否有可能获得活动窗口的路径....假设我已经打开了一些文件说somefile.txt ...我可以获取此文件的路径吗....扩展名是唯一的方法??
Thank you .... one more doubt... is it possible to obtain path of active window.... like suppose i have opened some file say somefile.txt ... can i obtain path of this.... shell extension is the only way???
您必须使用以下Windows API: GetForegroundWindow()和此处是C#中的一小段工作示例代码,其中显示了如何使用它们来获取当前活动窗口的路径.
You have to use these Windows APIs: GetForegroundWindow() and GetWindowThreadProcessId().And here is a small working sample code in C# which shows how to use them to obtain path to currently active window.
您想编写一个shell扩展.我假设用户正在单击文件系统.如果没有,则无法根据随机文件名轻松,快速地找到文件,也无法知道要显示哪个同名文件.
You want to write a shell extension. I am assuming the user is clicking in the file system. If not, then there''s no way to find the file easily and quickly based on a random filename, or know which file of the same name to show.
这篇关于单击鼠标获取文件路径名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文