Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : PM1.C

 
Output of file : PM1.C contained in archive : EMXTST8F.ZIP
/* pm1.c (emx+gcc) */

#include
#define INCL_WIN
#include
#include "pm1.h"

/* Test exception handler */

static void crash (void)
{
char *p;

p = 0;
*p = 0;
}


#pragma linkage (ClientWndProc, system) /* for ICC */

static MRESULT ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
HPS hps;
RECTL rcl;

switch (msg)
{
case WM_PAINT:
hps = WinBeginPaint (hwnd, 0L, 0L);
/* GpiErase (hps); */
WinQueryWindowRect (hwnd, &rcl);
GpiSetColor (hps, CLR_DARKCYAN);
WinDrawText (hps, -1, "Hello, world!", &rcl, 0, 0,
DT_TEXTATTRS | DT_CENTER | DT_VCENTER | DT_ERASERECT);
WinEndPaint (hps);
return (0);
case WM_COMMAND:
switch (SHORT1FROMMP (mp1))
{
case IDM_CRASH:
crash ();
return ((MRESULT)0);
case IDM_EXIT:
WinSendMsg (hwnd, WM_CLOSE, 0L, 0L);
return ((MRESULT)0);
}
break;

}
return (WinDefWindowProc (hwnd, msg, mp1, mp2));
}


int main (void)
{
static ULONG flFrameFlags;
static char szClientClass[] = "pm1.child";
HAB hab;
HMQ hmq;
HWND hwndFrame;
QMSG qmsg;

hab = WinInitialize (0) ;
hmq = WinCreateMsgQueue (hab, 0) ;

WinRegisterClass (hab, szClientClass, ClientWndProc,
CS_SIZEREDRAW, 0L);

flFrameFlags = (FCF_TITLEBAR | FCF_SYSMENU |
FCF_SIZEBORDER | FCF_MINMAX |
FCF_MENU | FCF_ACCELTABLE |
FCF_SHELLPOSITION | FCF_ICON |
FCF_TASKLIST);

hwndFrame = WinCreateStdWindow (
HWND_DESKTOP,
WS_VISIBLE,
&flFrameFlags,
szClientClass,
NULL,
0L,
0,
ID_PM1,
NULL) ;

while (WinGetMsg (hab, &qmsg, 0L, 0, 0))
WinDispatchMsg (hab, &qmsg);

WinDestroyWindow (hwndFrame);
WinDestroyMsgQueue (hmq);
WinTerminate (hab);
return (0);
}

/*
* Local variables:
* compile-command: "make pm1.exe"
* end:
*/


  3 Responses to “Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : PM1.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/