What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Detecting control mouse-over

[Help] Detecting control mouse-over
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. [Help] Detecting control mouse-over
Hi,

I would like to detect if the mouse pointer is over a specified control.
Is this possible, and if so, which functions should I use (I guess it has to do with the Windows API?)?

Thanks in advance.
07-09-2008 05:19 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] Detecting control mouse-over
You will need to monitor the window messages other then that there isn't a way.
07-09-2008 05:32 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [Help] Detecting control mouse-over
Okay, that'll do it. Thanks :D

Well, I guess I was wrong about the 1st sentence of this post..

I've inserted a "OnWindowidEvent_MessageNotification", yet nothing shows up in the debugger..

My code:
code:
function OnEvent_Initialize(MessengerStart) {
      WndMain = MsgPlus.CreateWnd("Windows.xml","WndMain",1);
}

function OnWndMainEvent_MessageNotification(PlusWnd,wMessage,wParam,lParam) {
      Debug.Trace("> Got message \"" + wMessage + "\" with wParam \"" + wParam + "\" and lParam \"" + lParam + "\"");
}



No, I was right :D

This post was edited on 07-09-2008 at 06:03 PM by SmokingCookie.
07-09-2008 05:33 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] Detecting control mouse-over
The problem with this:

quote:
Originally posted by SmokingCookie
code:
Debug.Trace("> Got message \"" + wMessage + "\" with wParam \"" + wParam + "\" and lParam \"" + lParam + "\"");


Is that you aren't defining any messages to watch. And your \ should be \\. Check the code below to get an idea:
code:
function OnEvent_Initialize(MessengerStart) {
      WndMain = MsgPlus.CreateWnd("Windows.xml","WndMain",1);
      WndMain.RegisterMessageNotification(0x200 /* WM_MOUSEMOVE */)
}

function OnWndMainEvent_MessageNotification(PlusWnd,wMessage,wParam,lParam) {
    switch(nMessage){
        case 0x200 /* WM_MOUSEMOVE */:
            // do stuff here
            break;
    }
}


This post was edited on 07-17-2008 at 02:06 PM by matty.
07-10-2008 01:24 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [Help] Detecting control mouse-over
Hi,

Thanks for the advice :)

Actually my piece of code was more to see if my window would receive any messages at all (it appeared not to receive them, because I did not register them..).

And about the \:

The debugger would say something like this:
code:
> Function called: OnWndMainEvent_MessageNotification
> Got message "78" with wParam "10119" and lParam "456204"


The \" means that the text to show in the debugger hasn't ended yet, but does contain a quotation mark ( " ).

This post was edited on 07-10-2008 at 02:53 PM by SmokingCookie.
07-10-2008 02:48 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] Detecting control mouse-over
quote:
Originally posted by SmokingCookie
The \" means that the text to show in the debugger hasn't ended yet, but does contain a quotation mark ( " ).
Haha!

I wasn't paying attention! By default Plus! wont make your script aware of any events unless you specifically tell it you want to know about them.
07-10-2008 05:15 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [Help] Detecting control mouse-over
It's early over there in Canada, isn't it? :P
07-10-2008 05:20 PM
Profile PM Find Quote Report
Jana.
New Member
*


Posts: 9
Joined: Jul 2008
RE: [Help] Detecting control mouse-over
How can I get the xy Positions out of the lParam i get back from the Message?
07-21-2008 09:10 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Help] Detecting control mouse-over
quote:
Originally posted by Jana.
How can I get the xy Positions out of the lParam i get back from the Message?
For stuff like that it is always a good idea to look things up in the MSDN Library:

=> WM_MOUSEMOVE
quote:
x is the low word of the double word lParam variable
y is the high word of the double word lParam variable
thus:

    var x = lParam & 0xFFFF
    var y = lParam >>> 16

don't confuse >>> (unsigned right shift operator) with >> (signed right shift operator). See Windows scripting docs for detailed info.

;)


PS: also read "The Old New Thing: Why do I get spurious WM_MOUSEMOVE messages?" if you want to use WM_MOUSEMOVE.


PS: Checking mouse movement over a control with the WM_MOUSEMOVE Windows Message is possible, but does not provide ways to detect if the mouse moved out of the control. For that you need to setup a mouse tracking/capturing message with the Windows API SetCapture.



This post was edited on 07-21-2008 at 12:52 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-21-2008 12:20 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On