home *** CD-ROM | disk | FTP | other *** search
- //#include "enum.h"
- #include <windows.h>
- bool __stdcall EnumProc (HWND hWnd, LPARAM /*lp*/)
- {
- LPDWORD pPid;
- DWORD result;
- HGLOBAL hg;
-
- if(hWnd==NULL)
- return false;
-
- hg = GlobalAlloc(GMEM_SHARE,sizeof(LPDWORD));
- pPid = (LPDWORD)GlobalLock(hg);
-
- result = GetWindowThreadProcessId(hWnd,pPid);
-
- if(result){
- char title[20];
- char className[20];
- char totalStr[42];
- GetClassName(hWnd,className,20);
- GetWindowText(hWnd,title,20);
- strcat(totalStr,title);
- strcat(totalStr,className);
- // ListBox1->Items->Add(totalStr);
- }
- else{
- GlobalUnlock(hg);
- GlobalFree(hg);
- return false;
- }
- GlobalUnlock(hg);
- GlobalFree(hg);
- return true;
- }
-