Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » grab the mouse
grab the mouse [message #455709] Thu, 19 May 2005 20:31 Go to next message
Amir Bukhari is currently offline Amir BukhariFriend
Messages: 8
Registered: July 2009
Junior Member
I want to grab the mouse totaly. I mean with grabing, that all low level
Mouse event should be send to my
application. in linux I can grab the pointer on X server. in windows I
should create a Hook.
is there any way to handle this in SWT?

sorry the fellowing may be more Windows specific!
I have create a small java with JNI. the JNI DLL register a hook like the
following:
thisInstance1 = LoadLibrary((LPCTSTR) "hockdll.dll");

hkMouse1 = (HOOKPROC)GetProcAddress(thisInstance1, "MouseHookProc");

printf("Hello2 world! %p %p\n", thisInstance1, hkMouse1);

g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hkMouse1, thisInstance1,NULL);

after running my java application I got a correct g_hMouseHook,
thisInstance1 and hkMouse1 . and also mouse stopped moving,
but my Hook function never got called. and after a few second the mouse
return to its normal execution, because windows wait.
Re: grab the mouse [message #455836 is a reply to message #455709] Fri, 20 May 2005 04:05 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Amir Bukhari:

Look at Control.setCapture()

> I want to grab the mouse totaly. I mean with grabing, that all low level
> Mouse event should be send to my
> application. in linux I can grab the pointer on X server. in windows I
> should create a Hook.
> is there any way to handle this in SWT?
>
> sorry the fellowing may be more Windows specific!
> I have create a small java with JNI. the JNI DLL register a hook like the
> following:
> thisInstance1 = LoadLibrary((LPCTSTR) "hockdll.dll");
>
> hkMouse1 = (HOOKPROC)GetProcAddress(thisInstance1, "MouseHookProc");
>
> printf("Hello2 world! %p %p\n", thisInstance1, hkMouse1);
>
> g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hkMouse1, thisInstance1,NULL);
>
> after running my java application I got a correct g_hMouseHook,
> thisInstance1 and hkMouse1 . and also mouse stopped moving,
> but my Hook function never got called. and after a few second the mouse
> return to its normal execution, because windows wait.
>
>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Re: grab the mouse [message #455843 is a reply to message #455836] Fri, 20 May 2005 08:21 Go to previous messageGo to next message
Amir Bukhari is currently offline Amir BukhariFriend
Messages: 8
Registered: July 2009
Junior Member
Control.setCapture() will capture all events sends my the system to our
appliation to be forwarded to
the control capture the mouse events. what I want is a global capture, I
want to capture all mouse events from system to be send to my application
that mean no other applicaton on the desktop should receive mouse events
when I register it.

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> schrieb im Newsbeitrag
news:T9j5kEPXFHA.2692@fairy.ao.nlmk...
> Amir Bukhari:
>
> Look at Control.setCapture()
>
>> I want to grab the mouse totaly. I mean with grabing, that all low level
>> Mouse event should be send to my
>> application. in linux I can grab the pointer on X server. in windows I
>> should create a Hook.
>> is there any way to handle this in SWT?
>>
>> sorry the fellowing may be more Windows specific!
>> I have create a small java with JNI. the JNI DLL register a hook like the
>> following:
>> thisInstance1 = LoadLibrary((LPCTSTR) "hockdll.dll");
>>
>> hkMouse1 = (HOOKPROC)GetProcAddress(thisInstance1, "MouseHookProc");
>>
>> printf("Hello2 world! %p %p\n", thisInstance1, hkMouse1);
>>
>> g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hkMouse1,
>> thisInstance1,NULL);
>>
>> after running my java application I got a correct g_hMouseHook,
>> thisInstance1 and hkMouse1 . and also mouse stopped moving,
>> but my Hook function never got called. and after a few second the mouse
>> return to its normal execution, because windows wait.
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: grab the mouse [message #455847 is a reply to message #455843] Fri, 20 May 2005 10:04 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Amir Bukhari:

> Control.setCapture() will capture all events sends my the system to our
> appliation to be forwarded to
> the control capture the mouse events. what I want is a global capture, I
> want to capture all mouse events from system to be send to my application
> that mean no other applicaton on the desktop should receive mouse events
> when I register it.

Well, just one advice: don't do this. :-)
And I don't belive that you can do this using only SWT.

>
> "Konstantin Scheglov" <scheglov_ke@nlmk.ru> schrieb im Newsbeitrag
> news:T9j5kEPXFHA.2692@fairy.ao.nlmk...
>
>>Amir Bukhari:
>>
>> Look at Control.setCapture()
>>
>>
>>>I want to grab the mouse totaly. I mean with grabing, that all low level
>>>Mouse event should be send to my
>>>application. in linux I can grab the pointer on X server. in windows I
>>>should create a Hook.
>>>is there any way to handle this in SWT?
>>>
>>>sorry the fellowing may be more Windows specific!
>>>I have create a small java with JNI. the JNI DLL register a hook like the
>>>following:
>>>thisInstance1 = LoadLibrary((LPCTSTR) "hockdll.dll");
>>>
>>>hkMouse1 = (HOOKPROC)GetProcAddress(thisInstance1, "MouseHookProc");
>>>
>>>printf("Hello2 world! %p %p\n", thisInstance1, hkMouse1);
>>>
>>>g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hkMouse1,
>>>thisInstance1,NULL);
>>>
>>>after running my java application I got a correct g_hMouseHook,
>>>thisInstance1 and hkMouse1 . and also mouse stopped moving,
>>>but my Hook function never got called. and after a few second the mouse
>>>return to its normal execution, because windows wait.
>>
>>
>>--
>>SY, Konstantin.
>>Advanced Eclipse SWT Designer (http://www.swt-designer.com)
>
>
>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Previous Topic:How to change the color of table column
Next Topic:Embedding Swings in SWT
Goto Forum:
  


Current Time: Wed May 08 12:10:53 GMT 2024

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

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

Back to the top