新版的qq登陆窗口的标题乱七八糟不能用FindWindow
怎么办。
怎么办。
解决方案 »
- MFC中如何将动态域名转化成IP
- 必需的资源无法得到!!在线等
- COM组件有一个方法HRESULT test([in]byte* aaa);请问能不能用VBScript调用?如何调用?
- 在ListCtrl中用右键弹出菜单,怎么只能弹出一次,第二次就失败了?
- 哪儿有最新的MSDN下载(提供一个有效的地址即结贴)
- 为什么我窗口上的BUTTON不能FALSE
- 当CFormView改变大小时怎样使其中的控件随着它一起改变,使比例不变,位置不变?
- 关于Socket的一个非常简单的问题(EventSelect模型的)
- .DEF和__declspec(dllexport),到底谁听谁的?
- 为什么每次写数据进文件时都写到开头呢?怎样才能不覆盖原有的数据呢?
- 在程序里设置墙纸的 WINDOWS API 是什么 ?
- 怎样在特定的程序运行时得到通知?
HWND hwndParent, // handle to parent window
HWND hwndChildAfter, // handle to a child window
LPCTSTR lpszClass, // pointer to class name
LPCTSTR lpszWindow // pointer to window name
);use lpszClass to identify the window handle.
类名是什么::如下
#32770(对话框)
示例:
找到"任务栏和开始菜单"的"自动隐藏"按钮
HWND hTaskBar = FindWindow(TEXT("#32770"),"任务栏和开始菜单 属性");
HWND hTab1 = FindWindowEx(hTaskBar,NULL,TEXT("#32770"),NULL);
HWND hAutoHide= FindWindowEx(hTab1,NULL,"Button","自动隐藏(&U)");
你把放到”启动“里不就OK了?
FAINT
FAINT
现在我想知道怎么得到它的HWND.
HWND hButton1= FindWindowEx(hQQ,NULL,"Button",NULL);
char sz[100];
GetWindowText(hButton1,sz,100);
if(IsWindow(hButton1))
MessageBox(NULL,sz,NULL,NULL);//弹出“记住密码”
HWND hButton1;
char sz[100];
hDlg=FindWindow(TEXT("#32770"),NULL);
hButton1= FindWindowEx(hDlg,NULL,"Button",NULL);
GetWindowText(hButton1,sz,100);if(!strcmp("记住密码",sz))
{
MessageBox(NULL,sz,"QQ已经运行",MB_OK|MB_ICONINFORMATION);
return 0;
}while(hDlg!=0)
{
hDlg = FindWindowEx(NULL,hDlg,TEXT("#32770"),NULL);
if(IsWindow(hDlg))
{
hButton1= FindWindowEx(hDlg,NULL,"Button",NULL);
GetWindowText(hButton1,sz,100); if(!strcmp("记住密码",sz))
{
MessageBox(NULL,sz,"QQ已经运行",MB_OK|MB_ICONINFORMATION);
return 0;
}
}
}
要获得它的窗口句柄,可以用钩子来实现。
LRESULT __declspec(dllexport)__stdcall CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)
{
PCWPSTRUCT pcw=(PCWPSTRUCT) lParam;
if(nCode>=0 && pcw && pcw->hwnd)
{
if(pcw->message==WM_SHOWWINDOW)
{
HWND hwnd=(HWND)pcw->hwnd;
CString strApplication;
CString strCommand=GetCommandLine();
int nnum=strCommand.ReverseFind('\\');
if(nnum!=-1)
{
strApplication=strCommand.Mid(nnum+1);
strApplication.TrimRight();
strApplication.TrimRight("\"");
}
if(strApplication == _T("QQ2000b.exe"))
HWND hwndtarget=hwnd;//get it now;
}
并不全对,有些qq登陆的时候"QQ用户登陆“这个东西可能会不见了
那时HWND hWnd = ::FindWindow(NULL,"");
到能找到一些,然后用里面的button来进行判断,
这样就万无一失了!!
代码如下:
HWND hFocus = GetFocus(); //键盘焦点
HWND glhTargetWnd = hWnd; //取目标窗口
HWND glhParentWnd = glhTargetWnd;
while(glhParentWnd != NULL)
{
glhTargetWnd = glhParentWnd;
glhParentWnd = GetParent(glhTargetWnd);
}
GetWindowText(glhTargetWnd,szCaption,100);
其中szCaption的内容就是"xxxxx".
to mrh123() GetWindowText不能找出qq的caption
{
HWND hWnd = ::WindowFromPoint(point);
}
得到hwnd就足够了