CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    Timisoara, Romania
    Posts
    433

    [RESOLVED] WM_KEYDOWN VK_RETURN problem

    Hi!

    I have a WinAPI application that creates a dialogbox from a template. this dialogbox contains a custom control, that I implement myself. This custom control contains two editboxes (created dynamically). The editboxes are single-line.
    The problem I have is that I need to receive VK_RETURN in the message WM_KEYDOWN (not after the button has been released) in the window procedure of the editbox (I have subclassed the editboxes to handle events) and I can't.
    Using Spy++, I have seen that the editbox DOES post the message, but I do not receive it in my "case WM_KEYDOWN:" section of EditProcedure. However, i receive WM_KEYUP when I press VK_RETURN and WM_KEYDOWN when I press VK_BACK.

    can anybody give me an idea about what to do?
    I am using VC++ 2008.

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: WM_KEYDOWN VK_RETURN problem

    Do your editboxes have the style ES_WANTRETURN?
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Aug 2006
    Location
    Timisoara, Romania
    Posts
    433

    Re: WM_KEYDOWN VK_RETURN problem

    Yeah, unfortunately, it happens as the documentation says:
    "This style has no effect on a single-line edit control." - it works only with a multiline editbox.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: WM_KEYDOWN VK_RETURN problem

    Afraid you need WH_MSGFILTER local hook.
    Best regards,
    Igor

  5. #5
    Join Date
    Aug 2006
    Location
    Timisoara, Romania
    Posts
    433

    Re: WM_KEYDOWN VK_RETURN problem

    Thanks a lot!

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

Featured