thank you arjay... that was kinda simple.
i have two questions:
1. why does "Program Manager" window appear in the list?
2. how come i only get the valid icon from explorer.exe? (im sure it comes from GetClassLong)
Code:BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { if(::GetWindow(hWnd, GW_OWNER) || !::IsWindowVisible(hWnd)) return TRUE; CFMain::CAppView* This = reinterpret_cast<CFMain::CAppView*>(lParam); HICON hIcon = (HICON)::GetClassLong(hWnd, GCL_HICON); int iX = This->ImageList.Add(hIcon); if(iX > -1) { HICON hIconSm = (HICON)::GetClassLong(hWnd, GCL_HICONSM); if(!hIconSm) hIconSm = hIcon; This->ImageListSmall.Add(hIconSm); } LPTSTR sText = NULL; int iY = ::GetWindowTextLength(hWnd) + 1; if(iY > 0) { sText = new TCHAR[iY]; ::GetWindowText(hWnd, sText, iY); } This->InsertItem(reinterpret_cast<int>(hWnd), sText, iX); if(sText) delete[] sText; return TRUE; }




Reply With Quote