Here is a program for the MacOS.  It is not the shortest by any means
whatsoever -- I do a lot of unnecessary stuff because I basically copied
it from apple sample code.  To repeat, you could just put a repeat loop
around the whole thing.  Better though would be to do an alert of some
kind.  But you need a rez compiler for that, so I didn't do it.

Ricky Morse


program macosHelloWorld;

    theWindow: WindowPtr;
    wBoundsRect: rect;
    gDone: boolean;
    myEvent: EventRecord;
    gotEvent: Boolean;                    {is returned event for me?}

procedure initToolbox;
        InitGraf(@thePort);               {initialize QuickDraw}
        InitFonts;                        {initialize Font Manager}
        InitWindows;                      {initialize Window Manager}
        TEInit;                           {initialize TextEdit}

        FlushEvents(everyEvent, 0);       {clear event queue}
        InitCursor;                       {initialize cursor to arrow}
    end; {initToolbox}

procedure drawTheText (w: WindowPtr);     {Draw the text on the window}
        s = 'Hello, World!';
        textLength, textHeight: integer;
        x, y: integer;
        info: fontInfo;
        setPort(w);                       {sets up the drawing port}
        TextFont(applFont);               {geneva}
        TextFace([]);                     {plain text}
        TextSize(72);                     {72 pts}

        GetFontInfo(info);                {get info on font height}

        textLength := StringWidth(s);     {save width and height}
        textHeight := info.ascent + info.leading;

                                          {center text on screen}

        x := (w^.portRect.right) - (w^.portRect.left);
        x := round(x / 2);

        x := round(x - (textLength / 2));

        y := (w^.portRect.bottom) - (w^;
        y := round(y / 2);

        y := round(y - (textHeight / 2));

        MoveTo(x, y);                     {draw the stuff}

    end; {drawTheText}

begin {macosHelloWorld}
    gDone := false;

    with screenBits.bounds do             {set the window size based on
the screen size}
        setRect(wBoundsRect, left + 4, top + 40, right - 4, bottom - 4);
                                          {create a new window}
    theWindow := newWindow(nil, wBoundsRect, '', true, documentProc,
pointer(-1), false, 0);


    repeat                                {wait until the user clicks
the mouse}
        gotEvent := WaitNextEvent(everyEvent, myEvent, 15, nil);
        if gotEvent then
            case myEvent.what of
                    gDone := true;
            end; {case}
    until gDone;

    DisposeWindow(theWindow);             {clear up window memory}

end. {macosHelloWorld}

submitted by: (Richard Morse)