home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / s12133.zip / APP.C next >
C/C++ Source or Header  |  1988-11-23  |  2KB  |  82 lines

  1. #define INCL_GPI
  2. #define INCL_WIN
  3.  
  4. #include <os2.h>
  5. #include <stddef.h>
  6. #include "APP.h"
  7.  
  8. HAB     hAB;
  9. HMQ     hMsgQ;
  10. HWND    hwndApp;
  11. HWND    hwndAppFrame;
  12. HWND    hwndKid;
  13. HWND    hwndKidFrame;
  14. HWND    hwndList;
  15. extern FONTMETRICS FontMetrics;
  16.  
  17. /* Write-once global variables */
  18. char    szAppName[10];
  19. char    szKidName[10];
  20. ULONG    style = FCF_STANDARD;
  21. ULONG    KidCtlData = FCF_TITLEBAR | FCF_SYSMENU;
  22.  
  23. SHORT cdecl main(  )
  24. {
  25.     QMSG    qMsg;
  26.  
  27.     hAB   = WinInitialize(NULL);
  28.     hMsgQ = WinCreateMsgQueue( hAB, 0 );
  29.  
  30.     WinLoadString( hAB, NULL, IDSNAME, sizeof(szAppName), (NPCH)szAppName );
  31.     WinLoadString( hAB, NULL, IDSKIDNAME, sizeof(szKidName), szKidName );
  32.  
  33.     if ( !WinRegisterClass( hAB, (NPCH)szAppName, (PFNWP)APPWndProc,
  34.             CS_CLIPCHILDREN | CS_SIZEREDRAW, NULL ) )
  35.         return( FALSE );
  36.  
  37.  
  38.     /* Create a window instance of class szAppName */
  39.     hwndAppFrame = WinCreateStdWindow(
  40.         HWND_DESKTOP,     /* specify desktop as parent window           */
  41.     FS_ICON | FS_ACCELTABLE | WS_VISIBLE,
  42.     &style,
  43.         (NPCH)szAppName,  /* window class name                          */
  44.         (NPCH)szAppName,  /* name appearing in window caption           */
  45.         0L,
  46.         NULL,             /*  use current executable module id          */
  47.     ID_APP,       /*  menu id and accelerator id and icon id    */
  48.         (HWND FAR *)&hwndApp  /* window handle                          */
  49.         );
  50.  
  51.     /* Create a child window of class KidClass */
  52.  
  53.  
  54. //                      Add the list box to the client window
  55. //
  56. /* note the LS_OWNERDRAW style.  This will cause a WM_DRAWITEM message
  57.    to be sent to the owner of the listbox                   */
  58.     hwndList = WinCreateWindow (hwndApp, WC_LISTBOX, NULL,
  59.                    WS_VISIBLE | LS_OWNERDRAW, 0, 0, 0, 0,
  60.                    hwndApp, HWND_BOTTOM, LID_LIST1, NULL, NULL);
  61.     WinSetWindowPos (hwndList, HWND_BOTTOM, 10, 10, (short) 100,
  62.                  (short) 100, SWP_SIZE | SWP_MOVE | SWP_SHOW);
  63.  
  64.  
  65.  /*set the item height in the listbox */
  66.     WinSendMsg(hwndList,LM_SETITEMHEIGHT,
  67.            MAKEULONG((SHORT)FontMetrics.lMaxBaselineExt,0),0L);
  68.  
  69.  
  70.  
  71.     while( WinGetMsg( hAB, (PQMSG)&qMsg, (HWND)NULL, 0, 0 ) )
  72.     {
  73.         WinDispatchMsg( hAB, (PQMSG)&qMsg );
  74.     }
  75.  
  76.     WinDestroyWindow( hwndAppFrame );
  77.     WinDestroyMsgQueue( hMsgQ );
  78.     WinTerminate( hAB );
  79. }
  80. /*
  81. */
  82.