Re: What does WinMain do?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hey, cool! (Unfortunately, I can't try it til monday)

I'll give you a proper answer when I get to work on monday.


On Fri, 12 Nov 2004 23:56:24 -0800, Derek Parnell
<guest at rapideuphoria.com> wrote:
> 
> posted by: Derek Parnell <ddparnell at bigpond.com>
> 
> Patrick Barnes wrote:
> >
> > On Fri, 12 Nov 2004 19:26:36 -0800, Derek Parnell <guest at
> > rapideuphoria.com>
> > > As Patrick doesn't want to use Win32lib , then the code inside win32lib.ew
> > > eventLoop() routine could be extracted and adjusted for his purposes.
> >
> > Yes, that was my plan... but eventLoop() does a lot of things.
> > I don't know what the core is, I suspect it's a single call to a
> > blocking c function, wrapped inside a loop.
> >
> 
> I guess this is the minimum code ...
> 
> }}}
<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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu