Article View: comp.os.os2.programmer
Article #1955Help with GNU C v2.2 and PM
From: Po W. Chiu
Date: Thu, 08 Oct 1992 21:15
Date: Thu, 08 Oct 1992 21:15
89 lines
2496 bytes
2496 bytes
I need help on simple PM programming with GNU C v2.2. I'm trying create
a PM window but all that happens is my os2/window changes title screen & icon
and returns to os2/window.
gnu -c hello.c
rc -r hello.rc hello.h hello.ico
link386 hello,,,,hello
rc hello.res
I've run the sample3 program and don't see any major difference in code.
Can anyone see any errors? Please post or email chiu@iscnvx.lmsc.lockheed.com
Thanks in advance for any info.
/************************************************************************/
#define INCL_PM
#define INCL_BASE
#define IDR_RESOURCES 1
#define INCL_WIN
#define INCL_GPI
#include <os2.h>
#include <stdlib.h>
#include "hello.h"
HAB hab;
HMQ hmq;
HWND hwndHello;
HWND hwndFrame;
char ClassName[]="Hello";
int main()
{
QMSG qmsg;
static ULONG FrameFlags =
FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX |
FCF_SYSMENU | FCF_SHELLPOSITION | FCF_TASKLIST;
static ULONG FrameStyle = WS_VISIBLE | FS_ICON;
hab = WinInitialize(0);
hmq = WinCreateMsgQueue(hab,0);
WinRegisterClass(hab, ClassName, (PFNWP) ClientWndProc, CS_SIZEREDRAW, 0);
hwndFrame = WinCreateStdWindow( HWND_DESKTOP, FrameStyle, &FrameFlags,
ClassName, 0L, WS_VISIBLE, (HMODULE) 0, IDR_RESOURCES,
&hwndHello);
WinShowWindow( hwndFrame, TRUE);
while (WinGetMsg(hab, &qmsg, NULL,0,0))
WinDispatchMsg(hab, &qmsg);
WinDestroyWindow(hwndFrame);
WinDestroyMsgQueue( hmq);
WinTerminate(hab);
}
MRESULT EXPENTRY ClientWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
{
HPS hps;
RECTL INVLDRECT;
switch(msg)
{
case WM_CREATE:
case WM_PAINT:
hps=WinBeginPaint(hwnd, 0, 0);
WinQueryWindowRect(hwnd, &INVLDRECT);
WinFillRect(hps, &INVLDRECT, CLR_WHITE);
WinEndPaint(hps);
return 0;
case WM_CLOSE:
WinPostMsg( hwnd, WM_QUIT, 0L, 0L);
return 0;
default:
return( WinDefWindowProc( hwnd, msg, mp1, mp2));
}
return 0;
}
Technical Details
Message-ID:
<1992Oct8.211548.4249@iscnvx.lmsc.lockheed.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!news.larc.nasa.gov!uakari.primate.wisc.edu!ames!kronos.arc.nasa.gov!iscnvx!chiuShow Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!news.larc.nasa.gov!uakari.primate.wisc.edu!ames!kronos.arc.nasa.gov!iscnvx!chiu From: chiu@iscnvx.lmsc.lockheed.com (Po W. Chiu) Subject: Help with GNU C v2.2 and PM Message-ID: <1992Oct8.211548.4249@iscnvx.lmsc.lockheed.com> Organization: Lockheed Missiles and Space Co. Distribution: comp.os.os2.programmer Date: Thu, 8 Oct 92 21:15:48 GMT Lines: 90