Results 1 to 4 of 4

Thread: Mouse Messages

  1. #1

    Thread Starter
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Mouse Messages

    If I have a whole bunch of child window controls and I'm getting there messages via WM_COMMAND, how can I get their mouse messages?? I need to be able to tell when the mouse is moving over them I passed ?S_NOTIFY if that makes any difference.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    You recieve a WM_MOUSEMOVE message when a mouse is moving on the window where your controls are placed.
    WM_MOUSEMOVE
    The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.

    A window receives this message through its WindowProc function.

    LRESULT CALLBACK WindowProc(
    HWND hwnd, // handle to window
    UINT uMsg, // WM_MOUSEMOVE
    WPARAM wParam, // key indicators
    LPARAM lParam // horizontal and vertical position
    );
    Parameters
    wParam
    Indicates whether various virtual keys are down. This parameter can be one or more of the following values. Value Description
    MK_CONTROL The CTRL key is down.
    MK_LBUTTON The left mouse button is down.
    MK_MBUTTON The middle mouse button is down.
    MK_RBUTTON The right mouse button is down.
    MK_SHIFT The SHIFT key is down.
    MK_XBUTTON1 Windows 2000/XP: The first X button is down.
    MK_XBUTTON2 Windows 2000/XP: The second X button is down.


    lParam
    The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
    The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

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

    Remarks
    Use the following code to obtain the horizontal and vertical position:

    xPos = GET_X_LPARAM(lParam);
    yPos = GET_Y_LPARAM(lParam);
    You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.
    So you can use the X and Y values of the cursor and check against the rectangular area of the control you want to know about to see if the mouse is moving on that control or not.
    Baaaaaaaaah

  3. #3
    jim mcnamara
    Guest
    Do you know about the system-wide mousehook WH_MOUSE?

  4. #4

    Thread Starter
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Arrow Hi

    no, can you please tell me how I use it, cause I'm sure I can tell whether the mouse is over a child window, without using the x and y coordinates, there be some sort of event sent.

    Does anyone know?
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width