开发者

How to get full path of a window in Windows Explorer

开发者 https://www.devze.com 2023-02-22 02:06 出处:网络
When I have to open a folder in Windows Explorer (for example d:\\myfolder\\test), I use ::GetForegroundWindow(开发者_JAVA百科) to get its Window Handle, and use ::GetWindowText to get the Title Text.

When I have to open a folder in Windows Explorer (for example d:\myfolder\test), I use ::GetForegroundWindow(开发者_JAVA百科) to get its Window Handle, and use ::GetWindowText to get the Title Text. But in the default windows the full path of the current window is not displayed (of course you can through tools-folder option-view-display full path in title bar to set the title bar to display full path), and the ::GetWindowText only gets test. If I want to get the full path d:\myfolder\test how can I get this by the windows handle got by ::GetForegroundWindow() ?

Any suggestions. Thanks.


By using the ShellWindows COM object. See this example on how the get the folder that an Explorer window is viewing.

0

精彩评论

暂无评论...
验证码 换一张
取 消