home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / ADCHOICE.ZIP / ADCHOICE.CPP next >
C/C++ Source or Header  |  1998-05-04  |  2KB  |  65 lines

  1. #include <windows.h>
  2.  
  3. BOOL CALLBACK EnumCallback(HWND thiswin,LPARAM buf)
  4. {
  5. LPSTR cbuf=(LPSTR)buf;
  6. GetWindowText(thiswin,cbuf,63);
  7. if(!strcmp(cbuf,"Category Mgr")) {
  8.   GetClassName(thiswin,cbuf,63);
  9.   return(FALSE);
  10.   }
  11. *((LPSTR)buf)=0;
  12. return(TRUE);
  13. }
  14.  
  15. int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR d3,int nCmdShow)
  16. {
  17. HWND Win0,Win1,AdWin;
  18. RECT pos;
  19. HANDLE hRunStop;
  20. LPCTSTR RunStopMutex="AdChoiceRunStopMutex";
  21. CHAR MatchWindowClass[64];
  22.  
  23. hRunStop=OpenMutex(MUTEX_ALL_ACCESS,FALSE,RunStopMutex);
  24. if(hRunStop) {
  25.   WaitForSingleObject(hRunStop,INFINITE);
  26.   Sleep(5000);
  27.   ReleaseMutex(hRunStop);
  28.   return(0);
  29.   }
  30.  
  31. hRunStop=CreateMutex(NULL,FALSE,RunStopMutex);
  32. AdWin=NULL;
  33. while(WaitForSingleObject(hRunStop,0)==WAIT_OBJECT_0) {
  34.   ReleaseMutex(hRunStop);
  35.   Win0=FindWindow("PointCastMainWndClass",NULL);
  36.   if(Win0) {
  37.     EnumChildWindows(Win0,(WNDENUMPROC)EnumCallback,(LPARAM)MatchWindowClass);
  38.     if(*MatchWindowClass) {
  39.       Win1=NULL;
  40.       while(Win1=FindWindowEx(Win0,Win1,MatchWindowClass,NULL)) {
  41.         AdWin=NULL;
  42.         while(AdWin=FindWindowEx(Win1,AdWin,MatchWindowClass,NULL)) {
  43.           if(GetWindowRect(AdWin,&pos)&&
  44.             (pos.right-pos.left==240)&&
  45.             (pos.bottom-pos.top==160)) {
  46.             while(ShowWindow(AdWin,SW_HIDE)) {
  47.               Sleep(1000);
  48.               if(WaitForSingleObject(hRunStop,0)!=WAIT_OBJECT_0) goto bailout;
  49.               ReleaseMutex(hRunStop);
  50.               }
  51.             goto restart;
  52.             }
  53.           }
  54.         }
  55.       }
  56.     }
  57.   restart:
  58.   Sleep(1000);
  59.   }
  60. bailout:
  61. if(AdWin) ShowWindow(AdWin,SW_RESTORE);
  62.  
  63. return(0);
  64. }
  65.