FindWindow函数怎么用的?谁给详细说说
解决方案 »
- CSplitterWnd分割本身View怎么不行?
- (DirectShow)为什么网络传视频要自己写发送filter和接受filter?
- LoadLibraryEx()加载DLL时,路径正确,但是GetLastError()返回127
- SetupFactory做安装问题
- 怎么不能退出程序
- Big-Endian and Little-Endian different? 希望看到高手的出现
- 界面调整问题:窗口大小调整后如何调整STATIC TEXT控件的位置
- 谁有扫描仪相关软件的开发经验?
- 如何任意修改对话框或者其中的任何一个或多个控件的BkColor、TextColor等
- VC++操作EXCEL中关于range.cut和range.copy问题
- 字体?????????????
- 怎样用directplay,在client中发送消息是群发!up有分!在线等!
LPCTSTR lpClassName, // 窗口的类名
LPCTSTR lpWindowName // 窗口的标题
);两个参数有一个就成。找记事本的HWND(用类名):
HWND hWndNotepad = ::FindWindow("Notepad",NULL);
LPCTSTR lpClassName,
LPCTSTR lpWindowName );
Parameters
lpClassName
Long pointer to a null-terminated string that specifies the class name or is an atom that identifies the class-name string. If this parameter is an atom, it must be a global atom created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of lpClassName; the high-order word must be zero.
lpWindowName
Long 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
A handle to the window that has the specified class name and window name indicates success. NULL indicates failure. To get extended error information, call GetLastError. msdn 的
if((hCurWindow= FindWindow(NULL,"QQ用户登录"))!=0||(hCurWindow=FindWindow(NULL,"OICQ用户登录"))!=0)
{//很明显,调用FindWindow()函数去获得QQ登陆窗口的句柄
String str;
str.sprintf("0x%x",hCurWindow);
}
HWND FindWindow(
LPCTSTR lpClassName, // 窗口的类名
LPCTSTR lpWindowName // 窗口的标题
);两个参数有一个就成。找记事本的HWND(用类名):
HWND hWndNotepad = ::FindWindow("Notepad",NULL);窗口的标题"我的电脑"
HWND hWnd = ::FindWindow(NULL,"我的电脑");
HWND hWndNotepad = ::FindWindow("Notepad",NULL);窗口的标题"我的电脑"
HWND hWnd = ::FindWindow(NULL,"我的电脑");
LPCTSTR lpClassName, // 窗口的类名
LPCTSTR lpWindowName // 窗口的标题
);
只要知道窗口的名字就可以了 然后将第一个参数LPCTSTR lpClassName设为NULL 就可以了
用一个句柄接收就OK了
hwnd = ::FindWindow(NULL, "我的程序的标题");