Thread: Ensuring That Main Child Window Receives Focus

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

    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,815
    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,868
    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,273
    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, 03: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, 07:58 AM