64,654
社区成员
发帖
与我相关
我的任务
分享
BOOL CALLBACK EnumWindowsProc(
HWND hwnd, // handle to parent window
LPARAM lParam // application-defined value
)
{
if(hwnd){
CEnumWinDlg *pThis =(CEnumWinDlg *)(LPVOID)(LONG)lParam;
DWORD pID,threadID;
TCHAR s[1024];
memset(s,0,1024);
GetWindowText(hwnd,s,1024);
pThis->m_listTitle.AddString(s);
threadID= GetWindowThreadProcessId(hwnd,&pID);
pThis->m_listPID.AddString(_itot(pID,s,10));
pThis->m_listThreadID.AddString(_itot(threadID,s,10));
return TRUE;
}
return FALSE;
}
void CEnumWinDlg::OnButton1()
{
m_listTitle.ResetContent();
m_listPID.ResetContent();
m_listThreadID.ResetContent();
EnumWindows(EnumWindowsProc,(LPARAM)(LONG)(LPVOID)this);
}