gusucode.com > 如何截取QQ密码和聊天内容、去掉QQ广告栏、添加QQ尾巴 > 如何截取QQ密码和聊天内容、去掉QQ广告栏、添加QQ尾巴/RemoteThreadMateQQ/RemoteThreadMateQQ.cpp
// RemoteThreadMateQQ.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "RemoteThreadMateQQ.h" #include "RemoteThreadMateQQDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // // 删掉通知区中程序已终止的空图标 // 这个函数在 Vista 或 法文XP 系统下出问题,所以发行版不再使用他 // #ifdef _DEBUG BOOL Handle_DeleteTrayNullIcon ( HWND hWndTrayOfTaskbar, BOOL &bNullBeDel) { if ( !IsWindow(hWndTrayOfTaskbar) ) return FALSE; bNullBeDel = FALSE; DWORD pid = 0; GetWindowThreadProcessId(hWndTrayOfTaskbar,&pid); if (pid==NULL) { TRACE ( _T("Get pid error!") ); return FALSE; } HANDLE hProcess = OpenProcess ( PROCESS_QUERY_INFORMATION|PROCESS_ALL_ACCESS, TRUE, pid ); if ( !hProcess ) return FALSE; ::SendMessage(hWndTrayOfTaskbar,WM_PAINT ,NULL,NULL); CRect rect; ::GetWindowRect(hWndTrayOfTaskbar,&rect); ::InvalidateRect(hWndTrayOfTaskbar,&rect,false); int iNum=(int)::SendMessage(hWndTrayOfTaskbar,TB_BUTTONCOUNT ,NULL,NULL); //获取任务栏上图标个数 unsigned long n = 0; TBBUTTON *pButton = new TBBUTTON; wchar_t name[256] = {0}; TBBUTTON BButton; ULONGLONG whd,proid; CString x; for(int i=0; i<iNum; i++) { ::SendMessage ( hWndTrayOfTaskbar, TB_GETBUTTON, i, (LPARAM)(&BButton) ); ReadProcessMemory ( hProcess, &BButton, pButton, sizeof(TBBUTTON), &n ); if ( pButton->iString != 0xffffffff) { try { ReadProcessMemory(hProcess,(void *)pButton->iString,name,255,&n); } catch(...) { } HwDbgLog ( L_TRACE, _T("%d : %s\n"),i+1,CString(name) ); } try { whd = 0; ReadProcessMemory(hProcess,(void*)pButton->dwData,&whd,4,&n); } catch(...) { } proid = NULL; GetWindowThreadProcessId ( (HWND)whd, (LPDWORD)&proid ); if ( proid == NULL ) { bNullBeDel = TRUE; ::SendMessage ( hWndTrayOfTaskbar,TB_DELETEBUTTON, i, 0 ); } } delete pButton; return TRUE; } void DeleteTrayNullIcon () { // 得到任务栏右下脚一块地方的句柄 HWND hStatus = ::FindWindow(_T("Shell_TrayWnd"),NULL); // 得到任务栏句柄 if ( !hStatus ) return; HWND hNotify = FindWindowEx(hStatus,NULL,_T("TrayNotifyWnd"),NULL); //右下角区域 if ( !hNotify ) return; HWND hNotify1 = FindWindowEx(hNotify,NULL,_T("SysPager"),NULL); if ( !hNotify1 ) return; HWND hWndTrayOfTaskbar = FindWindowEx(hNotify1,NULL,_T("ToolBarWindow32"),NULL);//右下角区域(不包括时间) if ( !hWndTrayOfTaskbar ) return; // 用 “找出该图标所对应的进程ID,如果该ID为NULL则删除该图标”的方法 BOOL bNullBeDel = FALSE; for ( int i=0; i<999; i++ ) { Handle_DeleteTrayNullIcon ( hWndTrayOfTaskbar, bNullBeDel ); if ( !bNullBeDel ) break; } } #endif ///////////////////////////////////////////////////////////////////////////// // CRemoteThreadMateQQApp BEGIN_MESSAGE_MAP(CRemoteThreadMateQQApp, CWinApp) //{{AFX_MSG_MAP(CRemoteThreadMateQQApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRemoteThreadMateQQApp construction CRemoteThreadMateQQApp::CRemoteThreadMateQQApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CRemoteThreadMateQQApp object CRemoteThreadMateQQApp theApp; ///////////////////////////////////////////////////////////////////////////// // CRemoteThreadMateQQApp initialization BOOL CRemoteThreadMateQQApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #ifdef _DEBUG DeleteTrayNullIcon (); #endif DeleteFile ( "c:\\RemoteThreadMateQQ.txt" ); CRemoteThreadMateQQDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }