1. onEvent ??

David
  I am having trouble trying to figure out how you set the callback for
  winProc to monitor events on main window. I don't think that you
  automatically set it up in WinMain will you please tell me what I have
  to do; onEvent doesn't seem to work in the main window ??
Bernie

new topic     » topic index » view message » categorize

2. Re: onEvent ??

Bernie wrote:

>  I am having trouble trying to figure out how you set
> the callback for winProc to monitor events on main
> window. I don't think that you automatically set it up
> in WinMain will you please tell me what I have to do;
> onEvent doesn't seem to work in the main window ??

No, onEvent works for the main window. Perhaps a tour through how Win32Lib
sets up the callbacks might clarify things.

The variable WndProcAddress holds the address of the single callback that
Win32Lib uses. It is assigned to windows is the createWindow() routine with
this snippet of code:

   store( wndClassEx, winExProc, WndProcAddress )

It replaces the default handler for controls in:

    window_func[id] = c_func( xGetWindowLong,
        { window_handle[id], GWL_WndProc, WndProcAddress } )

The callback is assigned to a Euphoria routine in get_proc_address(), which
assigns it to the WndProc routine. If you look at WndProc, the first thing
it tries to do is find the window handle:

   id = find( myHwnd, window_handle )

A few steps later, it checks to see if you set the onEvent hook. (The test
should actually read > -1, not > 0 ):

   if onEvent[ id ] > 0 then
      -- call routine
      call_proc( onEvent[id], { iMsg, wParam, lParam } )
   end if

The only Win32 controls that don't use this callback are Menu and MenuItem.
For these, I trap the WM_COMMAND sent by Win32. In these cases, the menu id
is passed in the wParam.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: onEvent ??

Thak You David
Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu