TCHAR szName[MAX_PATH] = {0};
HWND hwnd = GetForegroundWindow();
if(hwnd)
{
{
DWORD dwId = 0;
GetWindowThreadProcessId(hwnd, &dwId);
HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
0, dwId);
if(handle)
{
TCHAR szFileName[MAX_PATH] = {0};
DWORD dwLen = MAX_PATH;
/*GetProcessImageFileName(handle, szFileName, MAX_PATH);*/
QueryFullProcessImageName(handle, 0, szFileName, &dwLen);
int err = GetLastError();
}
}
}
通过HWND获取相应进程的名字
最新推荐文章于 2023-02-10 21:49:53 发布