home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
BITMSHOW.ZIP
/
BITMAPS.C
< prev
next >
Wrap
Text File
|
1990-12-21
|
3KB
|
105 lines
/* BITMAPS.C -- Display the system bitmaps
This program displays all the known, as of IBM OS/2 EE 1.2, system
bitmaps. They are displayed starting in the top left corner,
proceding left to right accros the page, and top to bottom down the
page. */
#define INCL_WIN
#include <os2.h>
/* the following two values determine the spacing for the display of
the system bitmaps. Smaller values will place the bitmaps closer
together. */
#define DELTA_X 60
#define DELTA_Y 60
MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM);
HAB hab;
int main(void)
{
static CHAR szClientClass [] = "SysBitmaps";
static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
FCF_SIZEBORDER | FCF_MINMAX |
FCF_SHELLPOSITION | FCF_TASKLIST ;
// FCF_MENU;
HMQ hmq;
HWND hwndFrame, hwndClient;
QMSG qmsg;
hab = WinInitialize(0);
hmq = WinCreateMsgQueue(hab, 0);
WinRegisterClass(hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0);
hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
&flFrameFlags, szClientClass, NULL,
0L, NULL, 0, &hwndClient);
while(WinGetMsg(hab, &qmsg, NULL, 0, 0))
WinDispatchMsg(hab, &qmsg);
WinDestroyWindow(hwndFrame);
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
return 0;
}
MRESULT EXPENTRY ClientWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
{
static SHORT cxClient;
static SHORT cyClient;
static USHORT usCommand;
HBITMAP hbm;
HPS hps;
POINTL aptl[2];
USHORT i;
usCommand = 0;
switch(msg)
{ case WM_SIZE : cxClient = SHORT1FROMMP(mp2);
cyClient = SHORT2FROMMP(mp2);
return 0;
case WM_PAINT : hps = WinBeginPaint(hwnd, NULL, NULL);
GpiErase(hps);
aptl[0].x = 0;
aptl[0].y = cyClient - DELTA_Y;
aptl[1].x = DELTA_X;
aptl[1].y = cyClient;
/* loop through the known system bitmaps. Currently there are 47 bitmaps
in IBM OS/2 EE 1.2. This value can be found by editing pmwin.h and
searching for SBMP, and looking for the largest number defined for
a system bitmap */
for (i = 1; i <= 47; i++)
{ hbm = WinGetSysBitmap(HWND_DESKTOP, i);
WinDrawBitmap(hps, hbm, NULL, aptl,
CLR_NEUTRAL, CLR_BACKGROUND, DBM_NORMAL);
if(aptl[1].x + DELTA_X > cxClient)
{ aptl[0].x = 0;
aptl[1].x = DELTA_X;
aptl[1].y = aptl[0].y;
aptl[0].y = aptl[0].y - DELTA_Y;
}
else
{ aptl[0].x = aptl[1].x;
aptl[1].x = aptl[1].x + DELTA_X;
}
GpiDeleteBitmap(hbm);
}
WinEndPaint(hps);
return 0;
}
return WinDefWindowProc(hwnd, msg, mp1, mp2);
}