Thread: notification of mouse hovering on edit

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    108

    notification of mouse hovering on edit

    Hello all,

    just wondering, if its possible to actually notice when a mouse hovers on an edit control.. As far as I know edit controls only send few notification messages.. all EN_* except for WM_CTLCOLOREDIT..

    So yeah, is there a way?

    thanks in advance

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Would checking for a WM_MOUSEMOVE Notification suffice? Perhaps you could just check the (X,Y) coordinates of the mouses location compared to the position/width/height of your edit.

    I.e.
    Is MouseX greater than EditLeft
    AND
    Is MouseX less than (EditLeft + EditWidth)
    Pentium 4 - 2.0GHz, 512MB RAM
    NVIDIA GeForce4 MX 440
    WinXP
    Visual Studio .Net 2003
    DX9 October 2004 Update (R.I.P. VC++ 6.0 Compatability)

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    108
    the thing is, this window i have is a child window, and the textbox covers all of the child windows' area..

    setting the WM_MOUSEMOVE detector on the parent's window procedure doesnt seem to fix it.. mousemove wasnt really detected

    I think im going to give up trying, and instead use a timer that keeps detecting the movement of the mouse and its position.. oh well

    thanks for the help anyways

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    try TrackMouseEvent() or _TrackMouseEvent()
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    return 0;
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    89
    Or you could use subclassing:

    Code:
    // Global
    WNDPROC OldEditProc;
    LRESULT CALLBACK DummyProc(HWND, UINT, WPARAM, LPARAM);
    
    
    
    // Inside WndProc
    HWND hEdit = CreateWindow(...);
    OldEditProc = (WNDPROC)SetWindowLong(hEdit, GWL_WNDPROC, (long)DummyProc);
    
    
    
    /* This "dummy" window proc only processes the WM_MOUSEMOVE
        message. It sends all messages the the original window proc
        stored in OldEditProc */
    
    LRESULT CALLBACK DummyProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        if(msg == WM_MOUSEMOVE) {
            // The cursor is inside the client area of the edit window
        }
    
        // Make sure the edit box functions properly
        return CallWindowProc(OldEditProc, hwnd, msg, wParam, lParam);
    }
    I hope this makes sense. If not, just say it and I'll make a full working example.
    Last edited by Snip; 07-22-2005 at 05:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit control text buffer
    By scurvydog in forum Windows Programming
    Replies: 4
    Last Post: 12-11-2008, 10:13 AM
  2. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  3. Subclassed edit not doing what it's supposed to
    By tyouk in forum Windows Programming
    Replies: 8
    Last Post: 01-21-2005, 10:25 PM
  4. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  5. I need help disabling Keyboard and Mouse input on Edit controls
    By Templario in forum Windows Programming
    Replies: 4
    Last Post: 01-07-2003, 12:59 AM