C++⿊客技术:获取窗⼝标题
⼤家学C++的初衷是啥?
不就是想装B吗?
接下来步⼊正题:咳咳咳
先来认识⼀个函数:GetWindowTextA()
它在MSDN的定义:int WINAPI GetWindowTextA( _In_ HWND hWnd, _Out_writes_(nMaxCount) LPSTR lpString, _In_ int nMaxCount);来说⼀下它的参数:
hWnd:窗⼝句柄
lpString:窗⼝标题
nMaxCount:指定缓冲区⼤⼩
⽤GetForegroundWindow()函数声明窗⼝句柄
HWND hWnd =GetForegroundWindow();
接下来就是获取进程ID
DWORD dwProcess;
LRESULT result =0;
DWORD dwPID =GetWindowThreadProcessId(hWnd,&dwProcess);
⽤OpenProcess()函数打开进程
HANDLE hProcess =OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcess);
下⾯就是源代码了,喜欢的来⼀波关注
#include<iostream>
#include<Windows.h>
using namespace std;
int main()
{
while(1)
{
HWND hWnd =GetForegroundWindow();
DWORD dwProcess;
LRESULT result =0;
DWORD dwPID =GetWindowThreadProcessId(hWnd,&dwProcess);
HANDLE hProcess =OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcess);
WCHAR wszProcessPath[MAX_PATH]={0};
DWORD dwSize = MAX_PATH;
QueryFullProcessImageNameW(hProcess,0, wszProcessPath,&dwSize);
CHAR wszTitle[MAX_PATH]={0};
result =GetWindowTextA(hWnd, wszTitle, MAX_PATH);
cout <<"窗⼝标题:"<< wszTitle << endl;
Sleep(500);
}
thread技术
SetConsoleTitle(L"QQ盗号");
system("pause");
return0;
}
好了,下⼀篇会讲键盘记录器HOOK技术

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。