CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Edit Control of Toolbar

  1. #1
    Join Date
    Sep 2019
    Posts
    11

    Edit Control of Toolbar

    Hello,

    I have a question regarding processing a WM_MOUSEMOVE or WM_MOUSEHOVER for an edit control whose parent is a toolbar; On the main window hWnd of the program, I have a toolbar hWndToolbar, and on the toolbar I have an edit control hWndEdit2;

    I want to process a WM_MOUSEHOVER for the edit control hWndEdit2 (basically when the mouse is for a certain time over the edit control, I want to show in a tooltip the entire path shown in the edit control..), but I am not able to figure out how to do it; I think some possibility would be to process WM_NCMOUSEHOVER for the main window hWnd since the toolbar is part of the non-client area of the main window, but in this case I guess it might be more difficult to know when the mouse is moving on the edit control of the toolbar.

    Other possibility I think would be to use subclassing; by providing a new window procedure for the toolbar (or for the edit control?)..however I have tried this but I don't know what message to process in the new window procedure for the toolbar (or for the edit control)..I have tried processing WM_MOUSEMOVE or WM_MOUSEHOVER but doesn't work..


    Any help is appreciated,
    Best,
    D Narcis

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,154

    Re: Edit Control of Toolbar

    I have tried processing WM_MOUSEMOVE or WM_MOUSEHOVER but doesn't work..
    When I was involved in c/c++ gui development and wanted to understand what was going on, I logged all received windows messages to a file. I could then examine the file at leisure to see what messages etc had been received by what window and the ordering.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.6.3)

  3. #3
    Join Date
    Sep 2019
    Posts
    11

    Re: Edit Control of Toolbar

    Quote Originally Posted by 2kaud View Post
    When I was involved in c/c++ gui development and wanted to understand what was going on, I logged all received windows messages to a file. I could then examine the file at leisure to see what messages etc had been received by what window and the ordering.
    There was a mistake from me, in fact with window subclassing it works, just that it should have been done with something like

    OriginalProcedure1 = (WNDPROC)SetWindowLongPtr(hWndEdit2, GWLP_WNDPROC, (LONG_PTR)NewProcedure1);

    instead of what I had previously:

    OriginalProcedure1 = (WNDPROC)SetWindowLong(hWndEdit2, GWL_WNDPROC, (LONG)NewProcedure1);

    Regarding logging messages in a file for examining them and the order, that's a good solution indeed for seeing what messages are generated..

    Many appreciations for the help..

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)