我想知道如何使用C#獲取當前活動窗口的路徑。使用窗口句柄獲取當前活動窗口的路徑
我得到currnet活動窗口
const int nChars = 256;
int handle = 0;
StringBuilder Buff = new StringBuilder(nChars);
handle = GetForegroundWindow();
的手柄現在我該怎樣得到這個窗口的路徑?
即: 「我的文檔」 窗口的路徑是
C:\Users\User\Documents
- == - == - ==編輯 - == - == - = -
我想要監視程序來監視「Windows資源管理器」,並查看用戶去哪裏?
(即:用戶轉至c:\,然後轉到程序文件,然後轉到Internet Explorer和我想這個路徑:C:\ Program Files文件\ Internet Explorer中
Windows沒有路徑。使用該窗口的進程具有當前路徑。你需要獲得這個過程。 – stark 2012-07-14 14:29:42
可能是重複的http://stackoverflow.com/questions/2265647/how-can-i-get-the-exe-path-of-the-foreground-window – Ria 2012-07-14 14:36:05
@Ria:這是不重複我想找到一個當前窗口的「Windows資源管理器」的路徑。你知道我嗎? – AminM 2012-07-14 17:14:42