TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Lee Wallace
from: Paul Edwards
date: 1996-11-03 11:56:48
subject: Where do I start ?

LW> Just exactly where do I start ?

LW> I want to program small apps and maybe small games for PM.

LW> What software and documentation will I need to get me started ?

EMX will give you the software.

LW> I can't program in C++ - yet but I guess it's about time I
LW> started. Are there any other powerful languages I can use?

C.

I know bugger-all about PM programming, but here is something to help you
get started...

/*********************************************************************/
/*                                                                   */
/*  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);
}
@EOT:

---
* Origin: X (3:711/934.9)

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™.