home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / PROC2.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-31  |  766 b   |  37 lines

  1. //#include "enum.h"
  2. #include <windows.h>
  3. bool __stdcall EnumProc (HWND hWnd, LPARAM /*lp*/)
  4. {
  5.    LPDWORD pPid;
  6.    DWORD result;
  7.    HGLOBAL hg;
  8.  
  9.    if(hWnd==NULL)
  10.       return false;
  11.  
  12.    hg = GlobalAlloc(GMEM_SHARE,sizeof(LPDWORD));
  13.    pPid = (LPDWORD)GlobalLock(hg);
  14.  
  15.    result = GetWindowThreadProcessId(hWnd,pPid);
  16.  
  17.    if(result){
  18.       char title[20];
  19.       char className[20];
  20.       char totalStr[42];
  21.       GetClassName(hWnd,className,20);
  22.       GetWindowText(hWnd,title,20);
  23.       strcat(totalStr,title);
  24.       strcat(totalStr,className);
  25.      // ListBox1->Items->Add(totalStr);
  26.    }
  27.    else{
  28.       GlobalUnlock(hg);
  29.       GlobalFree(hg);
  30.       return false;
  31.    }
  32.    GlobalUnlock(hg);
  33.    GlobalFree(hg);
  34.    return true;
  35. }
  36.  
  37.