Thread: setting focus on a dialog box control

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    setting focus on a dialog box control

    Is there a version of SetFocus() that works for controls ina dialog box?

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    I believe SetFocus() does work in dialogs. You can use GetDlgItem() to get the handle to use for SetFocus().

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    remember, that SetFocus() doesn't work on child controls until after the WM_CREATE or WM_INITDIALOG message has finished being processed by the parent window.

    using this function while handling either of those messages will achieve nothing.. you'll have to put that code else where or try and so something smart with Tab orders.

    hope this helps
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Display text in a Dialog Box
    By Dark_Phoenix in forum Windows Programming
    Replies: 9
    Last Post: 01-02-2009, 06:30 AM
  2. validate data in a dialog box
    By COBOL2C++ in forum Windows Programming
    Replies: 4
    Last Post: 09-22-2003, 01:55 PM
  3. problem with the open dialog box
    By stallion in forum Windows Programming
    Replies: 13
    Last Post: 02-19-2003, 08:28 AM
  4. Focus & Always-On-Top :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 06-13-2002, 05:44 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM