返回> 网站首页
进程操作
yoours2009-07-09 11:28:28
简介一边听听音乐,一边写写文章。
1. 当前程序的PID
DWORD dwProcessId;
GetWindowThreadProcessId(this->m_hWnd, &dwProcessId);
2. 通过进程ID取主窗口句柄
HWND Wnd=GetProcessMainWnd(iPid);
HWND GetProcessMainWnd(DWORD dwProcessId)
{
WNDINFO wi;
wi.dwProcessId = dwProcessId;
wi.hWnd = NULL;
EnumWindows(YourEnumProc,(LPARAM)&wi);
return wi.hWnd;
}
DWORD dwProcessId;
GetWindowThreadProcessId(this->m_hWnd, &dwProcessId);
2. 通过进程ID取主窗口句柄
HWND Wnd=GetProcessMainWnd(iPid);
HWND GetProcessMainWnd(DWORD dwProcessId)
{
WNDINFO wi;
wi.dwProcessId = dwProcessId;
wi.hWnd = NULL;
EnumWindows(YourEnumProc,(LPARAM)&wi);
return wi.hWnd;
}
文章评论
1301人参与,0条评论