What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] WM_MOUSEMOVE doesn't work

Pages: (4): « First « 1 [ 2 ] 3 4 » Last »
[?] WM_MOUSEMOVE doesn't work
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] WM_MOUSEMOVE doesn't work
I've got the return value 1, suggesting it should work.
04-20-2010 04:32 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] WM_MOUSEMOVE doesn't work
This example is from here: http://www.codeguru.com/forum/showthread.php?t=290195
c++ code:
//////////// Globals ////////////
// HWND hWndBtn1 = NULL;
// HWND hWndBtn2 = NULL;
// WNDPROC wpOrigButtonProc = NULL;
// HBITMAP hBmpNormal = NULL;
// HBITMAP hBmpHiLight = NULL;
// BOOL bMouseInWindow = FALSE;

// IDC_DLGBTN1 is a button resource
// IDC_DLGBTN2 is a button resource
// IDB_BMP_NORMAL is a bitmap resource
// IDB_BMP_HILIGHT is a bitmap resource

// in WM_INITDIALOG of main dialog procedure
hWndBtn1 = GetDlgItem(hWnd, IDC_DLGBTN1);
hWndBtn2 = GetDlgItem(hWnd, IDC_DLGBTN2);
     // load bitmaps
hBmpNormal  = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BMP_NORMAL));
hBmpHiLight = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BMP_HILIGHT));
     // set initial button images       
SendMessage(hWndBtn1, BM_SETIMAGE,
          (WPARAM)IMAGE_BITMAP, (LPARAM)hBmpNormal );
SendMessage(hWndBtn2, BM_SETIMAGE,
          (WPARAM)IMAGE_BITMAP, (LPARAM)hBmpNormal);
     // subclass buttons           
wpOrigButtonProc = (WNDPROC) SetWindowLong(hWndBtn1,
          GWLP_WNDPROC, (LONG) NewButtonProc);
/* same original btn proc */ SetWindowLong(hWndBtn2,
          GWLP_WNDPROC, (LONG) NewButtonProc);

// in WM_CLOSE of main dialog procedure
SetWindowLong(hWndBtn1, GWLP_WNDPROC, (LONG)wpOrigButtonProc);
SetWindowLong(hWndBtn2, GWLP_WNDPROC, (LONG)wpOrigButtonProc);

// NewButtonProc window procedure
LRESULT CALLBACK NewButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
     switch(uMsg)
     {
          case WM_MOUSEMOVE:
          {           
               if (!bMouseInWindow)
               {
                    bMouseInWindow = true;
                    SendMessage(hWnd, BM_SETIMAGE,
                         (WPARAM)IMAGE_BITMAP, (LPARAM)hBmpHiLight );
                    TRACKMOUSEEVENT tme;
                    tme.cbSize = sizeof(tme);
                    tme.dwFlags = TME_LEAVE;
                    tme.hwndTrack = hWnd;
                    TrackMouseEvent(&tme);
               }
          }
          break;
          case WM_MOUSELEAVE:
          {
               bMouseInWindow = false;
               SendMessage(hWnd, BM_SETIMAGE,
                    (WPARAM)IMAGE_BITMAP, (LPARAM)hBmpNormal);
          }
          break;
          default:
               return CallWindowProc(wpOrigButtonProc, hWnd,
                    uMsg, wParam, lParam);
     }
     return true;
}
04-20-2010 04:41 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: [?] WM_MOUSEMOVE doesn't work
Gotta admit that I'm absolutely rubbish at C++, but I'll give it a try...
04-20-2010 04:43 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] WM_MOUSEMOVE doesn't work
It is simply saying to declare the event from within WM_MOUSEMOVE but not sure why it should matter...

Anyways:

quote:
Originally posted by matty
What about tracking WM_MOUSEMOVE and use GetCursorPos then use ChildWindowFromPoint comparing the hWnd of the control to that returned from the function?
04-20-2010 04:46 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: [?] WM_MOUSEMOVE doesn't work
Well, I've got my own version of ChildWindowFromPoint. But the entire problem is the "tracking WM_MOUSEMOVE": I am not receiving it at all.
04-20-2010 04:50 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] WM_MOUSEMOVE doesn't work
quote:
Originally posted by SmokingCookie
Well, I've got my own version of ChildWindowFromPoint. But the entire problem is the "tracking WM_MOUSEMOVE": I am not receiving it at all.
That has to be something in your code then.

Attachment is untested as I am at work but let me know.

Not sure if it will work because I think the x and y coordiniates are in relation to the window not the screen. If this is the case then change the subclass routine to

js code:
function OnwndSubclassEvent_MessageNotification(pPlusWnd, nMessage, wParam, lParam) {
    switch (nMessage) {
        case WM_MOUSEMOVE:
            var POINT = Interop.Allocate(8);
            Interop.Call('user32', 'GetCursorPos', POINT);
                           
            var r = Interop.Call('user32', 'ChildWindowFromPointW', pPlusWnd.Handle, POINT);
            if (r !== null)
                Debug.Trace('i r on a control: '+r);
           
            return -1; // Process the message little one
    }
}

.plsc File Attachment: WM_MOUSEMOVE.plsc (1.75 KB)
This file has been downloaded 164 time(s).

This post was edited on 04-20-2010 at 05:23 PM by matty.
04-20-2010 05:19 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: [?] WM_MOUSEMOVE doesn't work
Got bad news for ya: it does not work. No message notifications are received.

Oh and btw:

quote:
Originally posted by MSDN article on WM_MOUSEMOVE
Return Value

If an application processes this message, it should return zero.

This post was edited on 04-20-2010 at 05:24 PM by SmokingCookie.
04-20-2010 05:23 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] WM_MOUSEMOVE doesn't work
Check the update :)
04-20-2010 05: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: [?] WM_MOUSEMOVE doesn't work
Nope, still the same
04-20-2010 05:25 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] WM_MOUSEMOVE doesn't work
quote:
Originally posted by SmokingCookie
Oh and btw:

quote:
Originally posted by MSDN article on WM_MOUSEMOVE
Return Value

If an application processes this message, it should return zero.

The -1 allows the window itself to process the message. The window will return 0.

I will investigate when I get home. This works fine with Screenshot Sender.
04-20-2010 05:28 PM
Profile E-Mail PM Find Quote Report
Pages: (4): « First « 1 [ 2 ] 3 4 » Last »
« 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