

![]() | 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 9, 2008 1:13:53 pm | |
| List: | net.java.dev.jna.users | |
I would like to implement a callback so that my Java app can have a System Tray Icon on Windows.
ExtractIcon, NOTIFYICONDATA, Shell_NotifyIcon and DestroyIcon have been employed through JNA and those seem to be working; the system tray icon shows and is later destroyed. During the test, the callback handle is "empty", so moving the mouse to the icon causes Windows to delete it. So I need to make a "real" callback handler.
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....
User32.WM_MOUSEMOVE wmMouseMove = new User32.WM_MOUSEMOVE() { public boolean MouseMove(HWND hwnd, int uMsg, int wParam, int lParam) { System.out.println("callback " + hwnd); return false; } };
Thread listener = new Thread("Mouse Move Listener") { public void run() { System.out.println("In the mouse move listener run method."); // Call some native thing here that returns a handle // Should it also block? } }; listener.start();
Am I getting anywhere close? Thanks for having a look.
--Dale--
I have added the following to User32.java:
public static interface WM_MOUSEMOVE extends com.sun.jna.win32.StdCallLibrary.StdCallCallback { public abstract boolean MouseMove(HWND hwnd, int uMsg, int wParam, int lParam); /* *LRESULT CALLBACK MouseMove( * HWND hwnd, [in] Handle to the window. * UINT uMsg, [in] Specifies the message. * WPARAM wParam, [in] Specifies additional message information. * LPARAM lParam [in] Specifies additional message information. *); *The return value is the result of the message processing and depends on the message sent. */ // TODO: figure out if wParam and lParam are really int }
WindowProc Function http://msdn.microsoft.com/en-us/library/ms633573(VS.85).aspx NOTIFYICONDATA http://msdn.microsoft.com/en-us/library/bb773352%28VS.85%29.aspx
***************************************************
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.
***************************************************







