home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / pespin132.exe / pespin132 / Examples / c / gui.c next >
Encoding:
C/C++ Source or Header  |  2004-12-10  |  1.5 KB  |  84 lines

  1. ////////////////////////////////////////////////////////////////
  2. //
  3. // Example of how to use CLEAR_START and CLEAR_END macros
  4. //
  5. ////////////////////////////////////////////////////////////////
  6.  
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include <math.h>
  10. #include "gui.h"
  11. #include "..\pespin.h"
  12.  
  13.  
  14. HINSTANCE hInst;
  15. int value = 0; 
  16.  
  17. // example proc
  18. unsigned int Inith()
  19. {
  20.  
  21. unsigned int i,j;
  22.  
  23. CLEAR_START
  24.  
  25.     for (i=1, j=1 ;i < 10 ;i++ )
  26.     {
  27.     j = j*i;
  28.     }
  29.     i=1;    //to avoid lcc bug
  30. CLEAR_END
  31.     return    j;
  32.  
  33. }
  34.  
  35.  
  36.  
  37. BOOL CALLBACK DlgP (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  38. {
  39.     switch (message)
  40.     {
  41.         // initialization of main window, its executed only one time
  42.         // so we can use CLEAR_START and CLEAR_END macros
  43.         case WM_INITDIALOG :
  44.  
  45.             // code between CLEAR_START and CLEAR_END will be executed
  46.             // and then erased from the memory
  47.             CLEAR_START
  48.  
  49.             SetWindowTextA(hDlg, "PESpin Markers Test");
  50.             SendMessage(hDlg,WM_SETICON,(LPARAM) 0,(WPARAM) LoadIcon(hInst,MAKEINTRESOURCE(ID_ICON)) );
  51.             
  52.             CLEAR_END
  53.  
  54.             return TRUE;
  55.  
  56.         case WM_COMMAND :
  57.             switch (LOWORD (wParam))
  58.             {
  59.                 case IDCANCEL :
  60.                     EndDialog (hDlg, 0);
  61.                     break;
  62.             }
  63.             break;
  64.     }
  65.  
  66.  
  67.     return FALSE;
  68. }
  69.  
  70. int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
  71. {
  72.     
  73.     CRYPT_START
  74.     
  75.     hInst=hInstance;
  76.     value=Inith();
  77.     
  78.     DialogBoxA(hInstance, MAKEINTRESOURCE(DLG_MAIN), 0, DlgP);
  79.     CRYPT_END
  80.             
  81.     return 0;
  82.     
  83. }
  84.