Thread: Want edit control to start with focus

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Want edit control to start with focus

    I have a dialog box in an MFC app, and I want a certain edit control to have focus as soon as the box is created. I have tried hooking various messages to the dialog box, but none of them seem to occur at the appropriate time.

    What is the best way to do this?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Set the focus in, and return FALSE from, OnInitDialog().

    gg

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Yeah thanks I eventually found it anyway.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

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. 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
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  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