3 messages in net.java.dev.jna.usersRE: [jna-users] SetWinEventHook
FromSent OnAttachments
Daniel BechterMar 19, 2008 8:23 am.java, .java, .java
Timothy WallMar 19, 2008 8:32 am 
Daniel BechterMar 19, 2008 9:02 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:RE: [jna-users] SetWinEventHookActions...
From:Daniel Bechter (dani@omicron.at)
Date:Mar 19, 2008 9:02:49 am
List:net.java.dev.jna.users

Hi Timothy,

it really works!! Thanks man. 'GetMessage' was not found, had to use 'GetMessageA' instead. I just do not get why it works now, just because the GetMessageA function was called... And the program really runs forever after calling GetMessageA...

Seems this project is more alive compared to the COM4J project, where I had to move to JACOB because of some problems...

Greetings, Daniel

_______________________ OMICRON electronics Gmbh

Company Registration No. FN 34227i, Commercial Court of Feldkirch

-----Original Message----- From: Timothy Wall [mailto:twal@dev.java.net] Sent: Wednesday, 19. March 2008 16:33 To: use@jna.dev.java.net Subject: Re: [jna-users] SetWinEventHook

I believe you have to set up a dedicated message handling loop in order to see any messages. See the low-level keyboard hook example in the contrib directory. Even though no events are processed in the loop (GetMessage never returns), without the call no events are ever seen.

I don't know enough about w32 internals to know what's going on. You'd think that the VM's message processing loop would be sufficient.

On Mar 19, 2008, at 11:23 AM, Daniel Bechter wrote:

Dear mailing list, I have already managed to successfully call some Win32 User32 functions. But I could not yet manage to receive Events. I need the "foreground window changed event". I am calling the function SetWinEventHook in the user32.dll and hand a WinEventProc callback into the function. Somehow I fail to receive the event. No exceptions however...

I have just attached the code (containing only this very problem, nothing else): Main.java: defines the callback and sets it User32.java: declares user32 functions (set, unset hook) and callback Win32TypeLib: defines types HANDLE, HWND, HWINEVENTHOOK

Hope somebody can help me.

<<Main.java>> <<User32.java>> <<Win32TypeLib.java>> < Main .java

< User32 .java

< Win32TypeLib .java

---------------------------------------------------------------------

To unsubscribe, e-mail: user@jna.dev.java.net For additional commands, e-mail: user@jna.dev.java.net