views:

444

answers:

1

I am embedding a windows application into my SWT application using 'reparenting'. That part works ok. I would now like to hook my SWT app into the message queue for the embedded app to receive mouse move events.

I see that the OS class in SWT has a number of interesting methods for adding hooks but I have not been able to figure out how to use them.

Can anyone help?

Thanks

+2  A: 

This should work, but it relies on using reflection to call non-API, so use it at your own risk.

Use reflection to make Display.addControl() and Display.removeControl() accessible. Then, use it to add the HWND of the Windows application and the owning control to the Display object. Now, when a mouse move event is sent to the embedded app, the corresponding Control should get a mouse move event.

For good measure you should add a DisposeListener on the owning Control and call removeControl() so events won't get sent to the dead HWND.

Scott K.
+1. Sounds interesting. Hope to be able to try this sometime soon
paul