盗妃天下有声小说39集:请explorer窗口的路径如何得到
来源:百度文库 编辑:查人人中国名人网 时间:2024/05/15 09:52:45
或者我有路径,直接去找相应的窗口也行
你没搞错吧,这是在用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,通过窗口句丙得到窗口标题(也就是路径),或通过枚举函数,获得所有窗体句柄,挑出你要控制的句柄