自动启动QQ

 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);   //模拟键盘输入
}

你可能感兴趣的:(自动启动QQ)