Re: What does WinMain do?
On Fri, 12 Nov 2004 23:56:24 -0800, Derek Parnell
<guest at rapideuphoria.com> wrote:
Hi Derek,
In your code below, it listens for a WM_QUIT message... how could a
program send that? And how would it send it to itself?
> }}}
<eucode>
> include dll.e
> include machine.e
>
> constant SIZEOF_MSG = 28
> constant user32 = open_dll("user32.dll")
> constant GetMessage = define_c_func(user32, "GetMessageA",
> {C_POINTER,C_POINTER,C_UINT,C_UINT}, C_INT)
> constant TranslateMessage = define_c_proc(user32, "TranslateMessage",
> {C_INT})
> constant DispatchMessage = define_c_proc(user32, "DispatchMessageA",
> {C_POINTER})
>
> procedure eventLoop()
> atom msg
> atom getRC
>
> -- Allocate a message buffer
> msg = allocate(SIZEOF_MSG)
> while 1 do
> -- message loop
> getRC = c_func( GetMessage, { msg, 0, 0, 0 } )
> if getRC = 0
> or getRC = -1 then
> exit -- User has sent a WM_QUIT message
> end if
>
> c_proc( TranslateMessage, { msg } )
> c_proc( DispatchMessage, { msg } )
> end while
>
> free(msg)
>
> end procedure
> </eucode>
{{{
>
>
> --
> Derek Parnell
> Melbourne, Australia
>
>
>
>
--
MrTrick
|
Not Categorized, Please Help
|
|