programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: circle in window .exe

From: Charles Melice <mail_at_forthcad.com>
Date: Wed, 18 Aug 1999 08:26:08 +0100

----------
> De : SF Talk <sftalk_at_forth.com>
> A : SF Talk <sftalk_at_forth.com>
> Objet : circle in window .exe
> Date : mercredi 18 août 1999 3:50
>
> Date: Tue, 17 Aug 1999 21:08:44 -0500
> From: "Marc Hawley" <Marc_Hawley_at_email.msn.com>
> Subject: circle in window .exe

Marc,

You are right. The following tested version make a poor stand-alone
circle.exe program.

But, as you say, a real program is in general more complicated.

For example, I use "HERE" to seek a PAINTSTRUCT. It would be better to
reserve dedicaced memory to avoid memory confict.

Thanks
Charles

\ --------------------------------------

FUNCTION: Ellipse ( hdc left top right bottom -- flag )

\ -A-
:NONAME ( -- res )
    MSG CASE
        WM_PAINT OF
            HWND HERE BeginPaint
            ( hdc) 10 10 110 110 Ellipse drop
            HWND HERE EndPaint drop
            0 EXIT
            ENDOF
    ENDCASE
    HWND MSG WPARAM LPARAM DefWindowProc ; 4 CB: CircleWindowProc

\ -B-
: RegCircleClass ( -- hclass )
    Z" CIRCLE-CLASS" CircleWindowProc DefaultClass ;

\ -C-
: CIRCLE ( -- )
    0 \ extended window style
    RegCircleClass \ address of registered class name
    Z" Just a circle" \ address of window name
    WS_OVERLAPPEDWINDOW WS_VISIBLE OR \ window style
    CW_USEDEFAULT dup 200 150 \ window position and size
    0 \ handle of parent or owner window
    0 \ handle of menu or child-window identifier
    HINST \ handle of application instance
    0 \ address of window-creation data
    CreateWindowEx drop ;

\ -D- to make a stand-alone .exe
\ see 8.1.4.5 in SwiftForth programming for Windows
: GO ( -- )
    CIRCLE
    IF DISPATCHER
    ELSE 0 Z" Can't create window" Z" Error"
         MB_OK MessageBox
    THEN
    ExitProcess ;

' GO 'MAIN !
PROGRAM CIRCLE

\\ EOF

.
Received on Wed Aug 18 1999 - 08:26:08 PDT

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:26 PST