大唐极品闲人下载:请explorer窗口的路径如何得到

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 01:58:29
在windows下浏览文件夹,如果我已经有一个特定的窗口句柄,怎么的到它的路径?即我有HWND,要得到比如D:\Program files\C++这种
或者我有路径,直接去找相应的窗口也行
你没搞错吧,这是在用VC++编程...

如果知道文件绝对路径,倒过来找窗口HWND很好办
HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);
Parameters
lpClassName
[in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.

If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.

lpWindowName
[in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.
Return Values
If the function succeeds, the return value is a handle to the window that has the specified class name and window name.

If the function fails, the return value is NULL

但是知道窗口能得到程序路径吗?还是先要得到进程名才行吧。

在文件夹选项->查看

高级设置中有在地址栏中显示完整路径

用API,通过窗口句丙得到窗口标题(也就是路径),或通过枚举函数,获得所有窗体句柄,挑出你要控制的句柄