home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1990 / 07 / grdlagen / os2funkt.c < prev    next >
C/C++ Source or Header  |  1989-06-20  |  1KB  |  64 lines

  1.  
  2. a) main-Funktion:
  3.  
  4. ======================================================
  5. int cdecl main(  )
  6. {
  7.   hab = WinInitialize( NULL );
  8.   hmq = WinCreateMsgQueue( hab, 0 );
  9.  
  10.   WinRegisterClass( ... );
  11.  
  12.   hwndFrame = WinCreateStdWindow( ... );
  13.  
  14.   while( WinGetMsg( ... )
  15.        WinDispatchMsg( ... );
  16.  
  17.   WinDestroyWindow( hwndFrame );
  18.   WinDestroyMsgQueue( hmq );
  19.   WinTerminate( hab );
  20.  
  21.   return 0;
  22. }
  23. ======================================================
  24.  
  25.  
  26.  
  27. b) Window-Funktion:
  28.  
  29. ======================================================
  30. MRESULT EXPENTRY ClientWindowProc( HWND hwnd, USHORT msg,
  31.                                    MPARAM mp1, MPARAM mp2 )
  32. {
  33.   switch( msg )
  34.   {
  35.  
  36.     case ...:           /* z. B. WM_CREATE  */
  37.       ...
  38.       return 0;
  39.  
  40.  
  41.     ...
  42.  
  43.  
  44.     case WM_CLOSE:
  45.       WinPostMsg( hwnd, WM_QUIT, 0L, 0L );
  46.       break;
  47.  
  48.     case ...:
  49.       ...
  50.       return 0;
  51.  
  52.  
  53.     ...
  54.  
  55.  
  56.     default:
  57.         /* für alle anderen Fälle muß(!) dieser Aufruf existieren  */
  58.       return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  59.   }
  60.   return 0;
  61. }
  62.  
  63. ======================================================
  64.