External (DLL) gadgets question

BlitzMax Forums/BlitzMax Programming/External (DLL) gadgets question

If I have a gadget attached to a Bmax window thru a DLL, is there anyway to get the external gadget to return events in BlitzMax (or some other communication mechanism)?

This is Windows only of course.

I think you need to implement a message hook, probably using SetWindowsHookEx

You have to create a window proceduer for the callback to catch the events of the gadget and a message handler.

The function to call is:

Function PostGuiEvent( id,source:TGadget=Null,data=0,mods=0,x=0,y=0,extra:Object=Null )

which can be found in maxgui.mod/event.bmx file

PostGuiEvent%(id%,source:TGadget="bbNullObject",data%=0,mods%=0,x%=0,y%=0,extra:Object="bbNullObject")="brl_maxgui_PostGuiEvent"


and looking in the .i file the call from c should be to "brl_maxgui_PostGuiEvent", I think... I don't see how you could call this directly from a dll though

If I get the hwnd of the external gadget into Bmax can I not construct an event system for it in Bmax itself? It is definitely triggering events, they just aren't very useful yet.

beak
http://www.blitzbasic.com/Community/posts.php?topic=53212

You can adapt the system used here to do it.

Thanks skn3 - I'm not sure how to merge it all together to make it work. I was thinking that someone would've done something like this already, but it seems not.