

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.java.dev.jna.usersStructuring of a Callback on Windows ...| From | Sent On | Attachments |
|---|---|---|
| Dale...@coats.com | May 9, 2008 1:13 pm | |
| Timothy Wall | May 9, 2008 1:25 pm | |
| Dale...@coats.com | May 11, 2008 1:58 pm | |
| Timothy Wall | May 11, 2008 4:44 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Structuring of a Callback on Windows User32 | Actions... |
|---|---|---|
| From: | Dale...@coats.com (Dale...@coats.com) | |
| Date: | May 11, 2008 1:58:55 pm | |
| List: | net.java.dev.jna.users | |
So to recap, I can create an tray icon fine. But so far with just an 'empty' window handle. When the OS realizes there's nobody to send messages to, it deletes the icon (as soon as you move your mouse to the icon). So I need to start a thread (I suppose) that has a window handle that I can give to the Shell_NotifyIcon so that the OS can use it when the mouse pointer is moved to the icon.
In the EnumWindows example, the OS didn't need a handle because we passed the object that had implemented the callback right into the EnumWindows method; it knew which object to run the callback on. In my the Shell_NotifyIcon example, the icon itself (NOTIFYICONDATA structure) knows which objects callback method to use only through the window handle that it has.
On Fri, 09 May 2008 16:26:12 -0400, Timothy Wall wrote:
On May 9, 2008, at 4:14 PM, Dale...@coats.com wrote:
// TODO: figure out if wParam and lParam are really int
LPARAM and WPARAM are defined in JNA's W32API class.
Thanks. That was something I should have seen.
Structuring the callback is a puzzle for me. I do not know how to proceed, re:"Call some native thing here", below, in the code....
(snip)
Callbacks have a single method, which must be named "callback". So rename your interface method "MouseMove" to "callback", and things should work.
I renamed the method, but that didn't do it. I think I'm missing a window handle, and I don't know how to get it. Starting a Java thread is not the answer (no native handle).
It seems to me that first I need to start some kind of "native thread" that has a window handle. This thread would have the callback method in it. Then I take that handle and use it when I create my Shell_NotifyIcon. Shell_NotifyIcon "knows" not only about what icon I want in the tray, but also the handle of the window that the OS will send events to.
Is this possible with JNA?
--Dale--
***************************************************
This communication may be confidential and privileged and the views expressed
herein may be personal and are not necessarily the views of Coats plc. It is for
the exclusive use of the intended recipient(s). If you are not the intended
recipient(s), please note that any distribution, copying or use of this
communication or the information in it is strictly prohibited. If you have
received this communication in error, please notify us by email
(Apps...@coats.com) or telephone our technical support helpdesk at Coats
plc. +44 (0)20 8210 5100 (UK 0830H - 1800H, Mon-Fri, GMT) and then delete the
email and any copies of it.
***************************************************







