How to get full path of a window in Windows Explorer
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.
精彩评论