home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / BITMSHOW.ZIP / BITMAPS.C < prev    next >
Text File  |  1990-12-21  |  3KB  |  105 lines

  1. /* BITMAPS.C -- Display the system bitmaps 
  2.  
  3.    This program displays all the known, as of IBM OS/2 EE 1.2, system 
  4.    bitmaps.  They are displayed starting in the top left corner,
  5.    proceding left to right accros the page, and top to bottom down the
  6.    page. */
  7.  
  8. #define INCL_WIN
  9. #include <os2.h>
  10.  
  11. /* the following two values determine the spacing for the display of 
  12.    the system bitmaps.  Smaller values will place the bitmaps closer
  13.    together. */
  14.  
  15. #define DELTA_X 60
  16. #define DELTA_Y 60
  17.  
  18. MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM);
  19.  
  20. HAB hab;
  21.  
  22. int main(void)
  23. {
  24.   static CHAR  szClientClass [] = "SysBitmaps";
  25.   static ULONG flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU  |
  26.                               FCF_SIZEBORDER    | FCF_MINMAX   |
  27.                               FCF_SHELLPOSITION | FCF_TASKLIST ;
  28. //                              FCF_MENU;
  29.   HMQ          hmq;
  30.   HWND         hwndFrame, hwndClient;
  31.   QMSG         qmsg;
  32.  
  33.   hab = WinInitialize(0);
  34.   hmq = WinCreateMsgQueue(hab, 0);
  35.  
  36.   WinRegisterClass(hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0);
  37.  
  38.   hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
  39.                                   &flFrameFlags, szClientClass, NULL,
  40.                                   0L, NULL, 0, &hwndClient);
  41.  
  42.   while(WinGetMsg(hab, &qmsg, NULL, 0, 0))
  43.     WinDispatchMsg(hab, &qmsg);
  44.  
  45.   WinDestroyWindow(hwndFrame);
  46.   WinDestroyMsgQueue(hmq);
  47.   WinTerminate(hab);
  48.   return 0;
  49. }
  50.  
  51. MRESULT EXPENTRY ClientWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  52. {
  53.   static SHORT cxClient;
  54.   static SHORT cyClient;
  55.   static USHORT usCommand;
  56.   HBITMAP      hbm;
  57.   HPS          hps;
  58.   POINTL       aptl[2];
  59.   USHORT       i;
  60.  
  61.   usCommand = 0;
  62.   switch(msg)
  63.     { case WM_SIZE : cxClient = SHORT1FROMMP(mp2);
  64.                      cyClient = SHORT2FROMMP(mp2);
  65.                      return 0;
  66.  
  67.       case WM_PAINT : hps = WinBeginPaint(hwnd, NULL, NULL);
  68.                       GpiErase(hps);
  69.  
  70.                       aptl[0].x = 0;
  71.                       aptl[0].y = cyClient - DELTA_Y;
  72.                       aptl[1].x = DELTA_X;
  73.                       aptl[1].y = cyClient;
  74.  
  75. /* loop through the known system bitmaps.  Currently there are 47 bitmaps
  76.    in IBM OS/2 EE 1.2.  This value can be found by editing pmwin.h and
  77.    searching for SBMP, and looking for the largest number defined for 
  78.    a system bitmap */
  79.  
  80.                       for (i = 1; i <= 47; i++)
  81.                         { hbm = WinGetSysBitmap(HWND_DESKTOP, i);
  82.     
  83.                           WinDrawBitmap(hps, hbm, NULL, aptl,
  84.                                CLR_NEUTRAL, CLR_BACKGROUND, DBM_NORMAL);
  85.     
  86.                           if(aptl[1].x + DELTA_X > cxClient)
  87.                             { aptl[0].x = 0;
  88.                               aptl[1].x = DELTA_X;
  89.                               aptl[1].y = aptl[0].y;
  90.                               aptl[0].y = aptl[0].y - DELTA_Y;
  91.                             }
  92.                           else
  93.                             { aptl[0].x = aptl[1].x;
  94.                               aptl[1].x = aptl[1].x + DELTA_X;
  95.                             }
  96.     
  97.                           GpiDeleteBitmap(hbm);
  98.                         }
  99.                       
  100.                       WinEndPaint(hps);
  101.                       return 0;
  102.     }
  103.   return WinDefWindowProc(hwnd, msg, mp1, mp2);
  104. }
  105.