逆向 | 查窗口名代码
逆向 | 查窗口名代码
存一份,有时候窗口名FindWindow找不到可能是少了空格之类的
#include <iostream>
#include <Windows.h>
using namespace std;
BOOL CALLBACK EnumChildProc( HWND hwnd, LPARAM lParam)
{
char szTitle[MAX_PATH] = {0};
char szClass[MAX_PATH] = {0};
int nMaxCount = MAX_PATH;
LPSTR lpClassName = szClass;
LPSTR lpWindowName = szTitle;
GetWindowTextA(hwnd, lpWindowName, nMaxCount);
GetClassNameA(hwnd, lpClassName, nMaxCount);
cout << "[Child window] window handle: " << hwnd << " window name: `"
<< lpWindowName << "` class name " << lpClassName << endl;
return TRUE;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
/*
* Remarks
The EnumWindows function does not enumerate child windows,
with the exception of a few top-level windows owned by the
system that have the WS_CHILD style.
*/
char szTitle[MAX_PATH] = {0};
char szClass[MAX_PATH] = {0};
int nMaxCount = MAX_PATH;
LPSTR lpClassName = szClass;
LPSTR lpWindowName = szTitle;
GetWindowTextA(hwnd, lpWindowName, nMaxCount);
GetClassNameA(hwnd, lpClassName, nMaxCount);
cout << "[Parent window] window handle: " << hwnd << " window name: `"
<< lpWindowName << "` class name " << lpClassName << endl;
//EnumChildWindows(hwnd, EnumChildProc, lParam);
return TRUE;
}
int main(int argc, char *argv[])
{
EnumWindows(EnumWindowsProc, 0);
system("pause");
return 0;
}
本文来自博客园,作者:Mz1,转载请注明原文链接:https://www.cnblogs.com/Mz1-rc/p/18287363
如果有问题可以在下方评论或者email:mzi_mzi@163.com