home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Fravia / fravia / browse.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  1.3 KB  |  80 lines

  1. /*----------------------------------------
  2.  win32  console application by Yamato 1997 
  3.  little utility to see all windows in the system, even those hidden
  4.  you can unhide any window you want
  5. -----------------------------------------*/
  6.  
  7. #include <stdio.h>
  8. #include <conio.h>
  9. #include <windows.h>
  10.  
  11. #define MAXWINDS 300
  12. #define MAXLINES 23
  13.  
  14.  
  15. typedef struct
  16. {
  17.     int status;
  18.     HWND hwnd;
  19.     char text[100];
  20. } stat;
  21.  
  22. stat winds[MAXWINDS];
  23. int count=0;
  24.  
  25.  
  26. BOOL CALLBACK myWinProc(HWND hwnd, LPARAM lParam)
  27. {
  28.     char title[100];
  29.  
  30.     GetWindowText(hwnd,title,99);
  31.     //printf("hwnd=%d, title=%s\n",hwnd, title );
  32.  
  33.     winds[count].hwnd = hwnd;
  34.     strcpy(winds[count].text, title);
  35.     count++;
  36.  
  37.     return TRUE;
  38. }
  39.  
  40. void main()
  41. {
  42.     //HWND hDesktop;
  43.     int i,idx;
  44.     int c;
  45.  
  46.     if(EnumWindows( (WNDENUMPROC)myWinProc, 77) == 0) 
  47.     {
  48.         printf("failed\n");
  49.         return;
  50.     }
  51.     
  52.     printf("No\tStatus\tHwnd\tName\n");
  53.     for(i=0;i<count;i++)
  54.     {
  55.         printf("%d\t%d\t%d\t%s\n",i,winds[i].status,
  56.             winds[i].hwnd,winds[i].text);
  57.         if( (i+1)%MAXLINES == 0 ) 
  58.         {
  59.             //maximum lines per page reached
  60.             printf("press any key to continue");
  61.             getch();
  62.             printf("\nNo\tStatus\tHwnd\tName\n");
  63.  
  64.         }
  65.     }
  66.     printf("\nWhich index?");
  67.     scanf("%d", &idx);
  68.     printf("\nWhat?");
  69.     c= toupper( getch() );
  70.     
  71.     if( c == 'H' )
  72.         ShowWindow(winds[idx].hwnd, SW_HIDE);
  73.     else ShowWindow(winds[idx].hwnd, SW_SHOW);
  74. }
  75.  
  76.  
  77.  
  78.  
  79.  
  80.