Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Implementing Untyped Messages for unknown message types(Implementing Untyped Messages for unknown message types)
Implementing Untyped Messages for unknown message types [message #850201] Thu, 19 April 2012 21:34 Go to next message
Peter Davis is currently offline Peter DavisFriend
Messages: 2
Registered: April 2012
Junior Member
I am trying to implement a 3dconnexion spacenavigator in an SWT application. after creating a small jni (win32 only at the moment) stub I was expecting to be able to post messages to the main Shell window using the windows SendMessage command. Then using the following in the SWT application

       
        int MY_MESSAGE = OS.RegisterWindowMessage(new TCHAR(0, "3dxEvent", true));

        shell.addListener(MY_MESSAGE, new Listener() {

            @Override
            public void handleEvent(Event event) {

                System.out.println("I cant beleive this worked");

            }

        });


Even posting a message from within the SWT application doesn't seem to work.

      OS.SendMessageW(shell.handle, MY_MESSAGE, 0, 0);

Any ideas?
Re: Implementing Untyped Messages for unknown message types [message #850991 is a reply to message #850201] Fri, 20 April 2012 14:38 Go to previous messageGo to next message
Peter Davis is currently offline Peter DavisFriend
Messages: 2
Registered: April 2012
Junior Member
OK, I've looked at the code and it appears you can't uses messages like this Sad SWT filters out unknown messages.

So the question becomes "If we have a native window accepting messages from an input device how can we send these messages to an SWT window"?
Re: Implementing Untyped Messages for unknown message types [message #856398 is a reply to message #850991] Wed, 25 April 2012 16:16 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Peter, this approach won't work. What you'll need to do:

- SWT subclasses the Windows proc. At the native level you'll have to
get and keep a handle to this subclass and then re-subclass the Windows
proc with your own Windows subclass.
- Your subclass will pass 99% of received messages (all those not from
your input device) to the stored swt subclass for normal processing.
- When a message is received from the input device then use JNI to
invoke a java method of yours.

HTH,
Grant


On 4/20/2012 10:38 AM, Peter Davis wrote:
> OK, I've looked at the code and it appears you can't uses messages like
> this :( SWT filters out unknown messages.
>
> So the question becomes "If we have a native window accepting messages
> from an input device how can we send these messages to an SWT window"?
Previous Topic:Detect a control is visible and skip drawing
Next Topic:OS X: handle reopen event (user clicked dock icon)
Goto Forum:
  


Current Time: Thu Apr 25 10:43:48 GMT 2024

Powered by FUDForum. Page generated in 0.03148 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top