Thread: Keeping focus on an edit control ...

  1. #1

    Keeping focus on an edit control ...

    I have a window (not a dialog) that contains 3 edit controls, during the WM_CREATE I call a SetFocus on the first edit of the group.
    The problem is, everytime I minimize the main window, or it get's hidden behind another window, the focus disappears from the edit control.
    I've tried just about everything I can think of in the window proc to try and combat this and have finally given up trying to solve it on my own and have come here seeking help.

    It's just a simple application, no MFC or classes.

  2. #2
    Join Date
    Jan 2002
    At a guess handle WM_ACTIVATE and call SetFocus from there.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Half solved the problem!

    WM_ACTIVATE handled if the window was covered by another one, but still won't handle if its minimized, I had assumed this was covered in WM_SIZE, but that doesn't seem to be working, I'll have to experiment some more, thanks for the help tho.

  4. #4
    Solved it, just created an HWND variable to store which window had the focus using GetFocus, and called SetFocus on the window during WM_ACTIVATE.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Controlling edit control input
    By Gerread in forum Windows Programming
    Replies: 6
    Last Post: 05-03-2007, 08:56 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Get Notified of ENTER in single line EDIT control
    By Morpheus in forum Windows Programming
    Replies: 1
    Last Post: 06-29-2002, 07:07 PM
  4. Controlling an edit control
    By master5001 in forum Windows Programming
    Replies: 2
    Last Post: 10-16-2001, 03:08 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM