home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bmp1.zip / ViewBmp.C < prev    next >
C/C++ Source or Header  |  1995-10-05  |  4KB  |  109 lines

  1. #pragma    title("View Bitmap  --  Version 1  --  (ViewBmp.C)")
  2. #pragma    subtitle("   main( ) - Interface Definitions")
  3.  
  4. #define    INCL_DOS           /* Include OS/2 DOS Kernal        */
  5. #define    INCL_WIN           /* Include OS/2 PM Windows Interface    */
  6.  
  7. #if defined(__IBMC__)
  8.  
  9. #pragma    info(nopar)
  10.  
  11. #endif
  12.  
  13. #include <os2.h>
  14.  
  15. #include "appdefs.h"
  16. #include "viewbmp.h"
  17.  
  18. /* This    module contains    routine    used as    the main entry point to    the    */
  19. /* Bitmap View application.                        */
  20.  
  21. /* Filename:   ViewBmp.C                        */
  22.  
  23. /*  Version:   1                            */
  24. /*  Created:   1995-07-06                        */
  25. /*  Revised:   1995-07-22                        */
  26.  
  27. /* Routines:   INT main(INT argc, CHAR *argv[ ]);            */
  28.  
  29.  
  30. /************************************************************************/
  31. /************************************************************************/
  32. /************************************************************************/
  33. /* DISCLAIMER OF WARRANTIES:                        */
  34. /* -------------------------                        */
  35. /* The following [enclosed] code is sample code    created    by IBM        */
  36. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  37. /* standard IBM    product    and is provided    to you solely for the purpose    */
  38. /* of assisting    you in the development of your applications.  The code    */
  39. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  40. /* Prominare shall be liable for any damages arising out of your    */
  41. /* use of the sample code, even    if they    have been advised of the    */
  42. /* possibility of such damages.                        */
  43. /************************************************************************/
  44. /************************************************************************/
  45. /************************************************************************/
  46. /*               D I S C L A I M E R                */
  47. /* This    code is    provided on an as is basis with    no implied support.    */
  48. /* It should be    considered freeware that cannot    be rebundled as        */
  49. /* part    of a larger "*ware" offering without our consent.        */
  50. /************************************************************************/
  51. /************************************************************************/
  52. /************************************************************************/
  53.  
  54. /* Copyright ╕ International Business Machines Corp., 1995.        */
  55. /* Copyright ╕ 1995  Prominare Inc.  All Rights    Reserved.        */
  56.  
  57. /* --------------------------------------------------------------------    */
  58.  
  59. PSZ pszViewBmpClassName    = (PSZ)"ViewBmp";
  60.  
  61.  
  62. INT main(INT argc, CHAR    *argv[ ])
  63.  
  64. {
  65. QMSG  qmsg;               /* PM Message Queue Holder        */
  66.  
  67.                /* Initialize the program for PM    and create the    */
  68.                /* message queue                    */
  69.  
  70. hmqViewBmp = WinCreateMsgQueue(hAB = WinInitialize(0UL), 0L);
  71.  
  72.                /* Register the window class            */
  73.  
  74. if ( !WinRegisterClass(hAB, pszViewBmpClassName, (PFNWP)BitmapViewerWndProc,
  75.                CS_SYNCPAINT | CS_SIZEREDRAW, 8UL) )
  76.    return(0);
  77.                /* Create the main program window        */
  78.  
  79. if ( !(hwndViewBmpFrame    = CreateStdWindow(HWND_DESKTOP,    WS_VISIBLE, FCF_NOBYTEALIGN | FCF_TASKLIST |
  80.                       FCF_TITLEBAR | FCF_ICON | FCF_SYSMENU    |
  81.                       FCF_MENU | FCF_MINMAX    | FCF_SIZEBORDER,
  82.                       pszViewBmpClassName, (PSZ)"Bitmap Viewer", 0L,
  83.                       (HMODULE)NULL, WIN_BITMAPVIEWER, &hwndViewBmp, 10, 10, 150, 75)) )
  84.    return(0);
  85.                /* Perform application initialization        */
  86.  
  87. InitApp(hwndViewBmpFrame, hwndViewBmp, NULL);
  88.  
  89.                /* Get and dispatch the message to program    */
  90.                /* windows                    */
  91.  
  92. while (    WinGetMsg(hAB, &qmsg, (HWND)NULL, 0UL, 0UL) )
  93.    WinDispatchMsg(hAB, &qmsg);
  94.  
  95.                /* Have received    a WM_QUIT, start the program    */
  96.                /* shutdown by destroying the program windows    */
  97.                /* and destroying the message queue        */
  98.  
  99. WinDestroyWindow(hwndViewBmpFrame);
  100.  
  101. WinDestroyMsgQueue(hmqViewBmp);
  102.  
  103.                /* Notify PM that main program thread not needed    */
  104.                /* any longer                    */
  105. WinTerminate(hAB);
  106.                /* Exit back to OS/2 cleanly            */
  107. return(0);
  108. }
  109.