| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | PM programs with Watcom C |
28 Dec 95 19:27, Coridon Henshaw wrote to All:
> What's the trick to compiling PM programs with Watcom C that don't bomb
> when the execute?
/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Modified instructions by Andrew Clarke. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simppm - the simplest PM program (roughly speaking) */
/* */
/* To compile this program, make sure you have a "simppm.def" file */
/* with "name simppm windowapi" in it, otherwise the linker won't */
/* generate a Presentation Manager executable. WATCOM C does not */
/* use this .def file, instead compile simppm using */
/* "wcl386 -l=os2v2_pm simppm.c" to tell the WATCOM linker to */
/* generate a PM executable. */
/* */
/*********************************************************************/
#define INCL_WIN
#include
MRESULT EXPENTRY simppm(HWND hwnd, ULONG msgType, MPARAM mp1, MPARAM mp2);
int main(void)
{
HAB hab;
HMQ hmq;
QMSG qmsg;
HWND hwndClient;
ULONG createFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_SIZEBORDER |
FCF_SHELLPOSITION;
hab = WinInitialize((ULONG) 0);
hmq = WinCreateMsgQueue(hab, (LONG) 0);
WinRegisterClass(hab, "simppm", simppm, (ULONG) 0, (USHORT) 0);
WinCreateStdWindow(
HWND_DESKTOP,
WS_VISIBLE,
&createFlags,
(PSZ) "simppm",
(PSZ) "simple program",
(ULONG) 0,
NULLHANDLE,
(ULONG) 0,
&hwndClient
);
while (WinGetMsg(hab, &qmsg, NULLHANDLE, (ULONG) 0, (ULONG) 0) == TRUE) {
WinDispatchMsg(hab, &qmsg);
}
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
return (0);
}
MRESULT EXPENTRY simppm(HWND hwnd, ULONG msgType, MPARAM mp1, MPARAM mp2)
{
int callDefault = 0;
MRESULT ret = (MRESULT) 0;
RECTL rectl;
switch (msgType) {
case WM_PAINT:
WinBeginPaint(hwnd, NULLHANDLE, NULL);
WinQueryWindowRect(hwnd, &rectl);
WinDrawText(
WinGetPS(hwnd),
(LONG) - 1,
"Hello There",
&rectl,
(LONG) 0,
(LONG) 0,
DT_CENTER | DT_VCENTER | DT_ERASERECT | DT_TEXTATTRS
);
WinEndPaint(hwnd);
break;
default:
callDefault = 1;
break;
}
if (callDefault) {
ret = WinDefWindowProc(hwnd, msgType, mp1, mp2);
}
return (ret);
}
Andrew
--- Msgedsq/2 3.30
* Origin: Blizzard of Ozz, Melbourne, Australia (3:633/267.1{at}fidonet)SEEN-BY: 50/99 620/243 632/348 998 633/154 246 260 267 371 373 374 634/384 SEEN-BY: 635/301 502 503 544 639/252 711/409 410 413 430 808 809 934 955 SEEN-BY: 712/515 713/888 800/1 7877/2809 @PATH: 633/267 374 371 635/503 50/99 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.