Posted on 2006-11-30 14:48
济公 阅读(776)
评论(2) 编辑 收藏 引用 所属分类:
VC++
ShellExecute(NULL, "open",
"d:\\Program Files\\Tencent\\QQ\\QQ.exe",
NULL, NULL, SW_HIDE);
::Sleep(2300); //设置时间等待QQ打开,
char szText[256];
HWND hWnd=::FindWindow(NULL,"QQ用户登录");
if(hWnd==NULL)
{
MessageBox("QQ打开不成功!");
return;
} //判断QQ是否打开成功
HWND hEdit = FindWindowEx(hWnd,NULL,"ComboBox",NULL);
::SendMessage(hEdit,WM_SETTEXT,0,((LPARAM)"448098551")); //设置QQ号码
HWND hDiaPass = ::FindWindowEx(hWnd,NULL,"#32770",NULL);
HWND hPass=::GetDlgItem(hDiaPass,0x3EA6);
char str[15]=" 密码 ";
int i;
for(i=0;i<12;i++)
{
::SendMessage(hPass,WM_CHAR,TCHAR(str[i]),0);
Sleep(200); //模拟键盘输入
}