[?] WM_MOUSEMOVE doesn't work |
Author: |
Message: |
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. [?] WM_MOUSEMOVE doesn't work
I seem to have a problem detecting mouse movement through WM_MOUSEMOVE. Is there a problem with my script or this message?
The point is: I want to check whether the mouse is over a control or not. I suppose that can be done with this message?
This post was edited on 04-18-2010 at 06:08 PM by SmokingCookie.
|
|
04-18-2010 07:24 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] WM_MOUSEMOVE doesn't work
Likely just a problem with your code. Post what you have and lets take a look.
|
|
04-18-2010 03:01 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: RE: [?] WM_MOUSEMOVE doesn't work
quote: Originally posted by matty
Likely just a problem with your code.
You're right about that. I have solved it, but now there's another problem: I cannot press any button in the window. In fact, the window behaves as if it were disabled. It gets enabled when the window is deactivated (i.e. minimised) and activated again. Can it be that this has something to do with the SetCapture function?
Figured a lot out: SetCapture causes a window to detect mouse movement, but disables most of its other input stuff. However, not using SetCapture means you cannot detect mouse movement. The disabled-like behaviour is caused by SetCapture. Minimising and restoring position releases capture from the window and allows you to click buttons, etc.
But I still need to detect mouse movement
Post no. 700
This post was edited on 04-18-2010 at 06:08 PM by SmokingCookie.
|
|
04-18-2010 05:50 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
|
04-19-2010 01:08 AM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: RE: [?] WM_MOUSEMOVE doesn't work
quote: Originally posted by MSDN page about _TrackMouseEvent
dwFlags
DWORD
Specifies the services requested. This member can be a combination of the following values.
[DWORD values]
There is nothing like TME_ENTER that is fired when the mouse leaves a control. Or do I need to use TME_HOVER for that...?
Surprise, surprise: been messing around a little, and don't get it
Problem could be that I've worked from 5 to 8 after school
This post was edited on 04-19-2010 at 07:43 PM by SmokingCookie.
|
|
04-19-2010 07:12 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: [?] WM_MOUSEMOVE doesn't work
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
04-20-2010 02:05 AM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [?] WM_MOUSEMOVE doesn't work
Well, I'll never do ANY kind of programming/scripting after a full day of school and work, before going to bed. I've been busy with this all night long
But that's had positive consequences too. I've thought of the following theory: upon a call to _TrackMouseEvent, <some message>* will be posted to the window when the mouse moves over it. When the mouse leaves the window, some other message is posted.
* Can this be WM_MOUSEMOVE?
|
|
04-20-2010 02:10 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] WM_MOUSEMOVE doesn't work
We used WM_MOUSEMOVE in Screenshot Sender.
http://beta.screenshotsender.com/code/WindowHandl...ectArea_handler.js
Tried something like this?
js code: /* Create your window*/
pPlusWnd.RegisterMessageNotification(0x02A1 /* WM_MOUSEHOVER */)
var TRACKMOUSEEVENT = Interop.Allocate(16);
TRACKMOUSEEVENT.WriteDWORD(0, 16);
TRACKMOUSEEVENT.WriteDWORD(4, 0x1 /* TME_HOVER */);
TRACKMOUSEEVENT.WriteDWORD(8, pPlusWnd.GetControlHandle('myControl'));
TRACKMOUSEEVENT.WriteDWORD(12, 1);
function OnWindowSubClassEvent_MessageNotification(pPlusWnd, nMessage, wParam, lParam) {
switch (nMessage) {
case 0x02A1 /* WM_MOUSEHOVER */:
Debug.Trace('i r on your control');
}
}
This post was edited on 04-20-2010 at 02:58 PM by matty.
|
|
04-20-2010 02:52 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [?] WM_MOUSEMOVE doesn't work
JScript code: // Windows.js;
objPlusWnd.RegisterMessageNotification(WM_MOUSEHOVER,true);
var TRACKMOUSEEVENT = Interop.Allocate(16);
with(TRACKMOUSEEVENT) {
writeDWORD(0,Size);
writeDWORD(4,TME_HOVER);
writeDWORD(8,objPlusWnd.GetControlHandle("BtnViewPage"));
writeDWORD(12,1);
}
Interop.Call("Comctl32.dll","_TrackMouseEvent",TRACKMOUSEEVENT.DataPtr);
//Interop.Call("User32.dll","TrackMouseEvent",TRACKMOUSEEVENT.DataPtr);
TRACKMOUSEEVENT.Size = 0;
// WndSettings_Notif.js;
function OnWndSettings_NotifEvent_MessageNotification(PlusWnd,Message,wParam,lParam) {
if(Hotkey_HandleEvent(PlusWnd,Message,wParam,lParam)) return -1;
switch(Message) {
case WM_MOUSEHOVER:
Print("i r on ur control");
return 0;
}
}
But it ain't exactly working...
This post was edited on 04-20-2010 at 04:09 PM by SmokingCookie.
|
|
04-20-2010 04:08 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] WM_MOUSEMOVE doesn't work
What is the return value of the TrackMouseEvent call?
What about tracking WM_MOUSEMOVE and use GetCursorPos then use ChildWindowFromPoint comparing the hWnd of the control to that returned from the function?
This post was edited on 04-20-2010 at 04:37 PM by matty.
|
|
04-20-2010 04:25 PM |
|
|
Pages: (4):
« First
[ 1 ]
2
3
4
»
Last »
|
|