Ensuring That Main Child Window Receives Focus

This is a discussion on Ensuring That Main Child Window Receives Focus within the Windows Programming forums, part of the Platform Specific Boards category; Hello, Quick question: how do I make sure that the solitary child window in my main window receives the focus ...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262

    Ensuring That Main Child Window Receives Focus

    Hello,

    Quick question: how do I make sure that the solitary child window in my main window receives the focus when the window is first created?

    Just putting SetFocus(hwndChild) in the creation message handler doesn't work.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,208
    Presumably there is also a control in the window that you wish to ensure has focus. Use SetFocus(that_control) as well.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Also make sure you return FALSE is you set the focus to a control or TRUE if you don't set the focus in the WM_CREATE or WM_INITDIALOG msg.
    "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

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Cracking stuff, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  2. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  3. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 02:22 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Receiving messages from child of a child.
    By Sindol in forum Windows Programming
    Replies: 3
    Last Post: 01-26-2002, 06:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21