HWnd hwndlist = getdlgitem (hwnd, idc_processmodulelist); setwindowredraw (hwndlist, false); comboBOX_RESETCONTENT (HWNDLIST);
CToolhelp thProcesses (TH32CS_SNAPPROCESS); PROCESSENTRY32 pe = {sizeof (pe)}; BOOL fOk = thProcesses.ProcessFirst (& pe); for (; fOk; fOk = thProcesses.ProcessNext (& pe)) {TCHAR sz [1024];
// Place the process name (without its path) & ID in the list PCTSTR pszExeFile = _tcsrchr (pe.szExeFile, TEXT ( '//')); if (pszExeFile == NULL) pszExeFile = pe.szExeFile; else pszExeFile ; // Skip over the slash wsprintf ("% s (" 0x% 08x) "), pszexefile, pe.th32processid; int n = comboBOX_ADDSTRING (HWndList, SZ);
// Associate the process ID with the added item ComboBox_setitemdata (hwndlist, n, pe.th32processid);} combobox_setcurseel (hwndlist, 0); // select the first entry
// Simulate the user selecting this first item so what the the // results Pane Shows Something Interesting Forward_WM_Command (HWND, Idc_ProcessModuleList, Hwndlist, CBN_Selchange, SendMessage);
SetwindowRedraw (HWndList, true); InvalidateRect (HWndList, Null, False);