home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / S12733.ZIP / HELLO.C < prev    next >
C/C++ Source or Header  |  1990-10-17  |  2KB  |  77 lines

  1. #define INCL_PM
  2.  
  3. #include <os2.h>
  4. #include "stdio.h"
  5. #include <stddef.h>
  6. #include "hello.h"
  7.  
  8.  
  9. HAB     hAB;
  10. HMQ     hmqHello;
  11. HWND    hwndHello;
  12. HWND    hwndHelloFrame;
  13. HWND    hwndInfo;
  14. CHAR    szClassName[] = "Hello";
  15. CHAR    szMessage[]   = "Hello World";
  16.  
  17. PFNWP pfnHelloWndProc;
  18.  
  19. int cdecl main( )
  20. {
  21.     QMSG qmsg;
  22.     ULONG ctldata;
  23.  
  24.     hAB = WinInitialize(0);
  25.  
  26.     hmqHello = WinCreateMsgQueue(hAB, 0);
  27.  
  28.     if (!WinRegisterClass( hAB,(PCH)szClassName,(PFNWP)HelloWndProc,
  29.                CS_SYNCPAINT | CS_SIZEREDRAW,
  30.                            0))
  31.         return( 0 );
  32.  
  33.     if (!WinRegisterClass( hAB,(PCH)"InfoClass",(PFNWP)InfoWndProc,
  34.                            CS_SYNCPAINT | CS_SIZEREDRAW | CS_CLIPSIBLINGS,
  35.                            0))
  36.         return( 0 );
  37.  
  38.     ctldata = FCF_STANDARD &~FCF_ACCELTABLE;
  39.  
  40.     hwndHelloFrame = WinCreateStdWindow( HWND_DESKTOP,
  41.                      WS_VISIBLE,
  42.                      &ctldata,
  43.                                          (PCH)szClassName,
  44.                      (PCH) NULL,
  45.                                          0L,
  46.                                          (HMODULE)NULL,
  47.                                          ID_HELLO,
  48.                                          (HWND FAR *)&hwndHello );
  49.  
  50.     hwndInfo=WinCreateWindow(hwndHelloFrame,
  51.             "InfoClass",
  52.             NULL,
  53.             0,
  54.             0,0,
  55.             0,0,
  56.             hwndHelloFrame,
  57.                     WinWindowFromID(hwndHelloFrame, FID_MINMAX),
  58.             ID_INFOWINDOW,
  59.             NULL,
  60.             NULL);
  61.  
  62.     pfnHelloWndProc=WinSubclassWindow(hwndHelloFrame, (PFNWP) FrameSubProc);
  63.  
  64.     WinSendMsg(hwndHelloFrame, WM_UPDATEFRAME, 0L,0L);
  65.  
  66.     WinShowWindow( hwndHelloFrame, TRUE );
  67.  
  68.     while( WinGetMsg( hAB, (PQMSG)&qmsg, (HWND)NULL, 0, 0 ) )
  69.     {
  70.         WinDispatchMsg( hAB, (PQMSG)&qmsg );
  71.     }
  72.  
  73.     WinDestroyWindow( hwndHelloFrame );
  74.     WinDestroyMsgQueue( hmqHello );
  75.     WinTerminate( hAB );
  76. }
  77.