Thread: get handle modal dialog

  1. #1
    Registered User eth0's Avatar
    Join Date
    Dec 2003

    get handle modal dialog

    how do you get a handle to a modal dialog from outside of the dialogs procedure?

    I need to be able to send messages to it.

    Open source isn't a matter of life or death......
    .......its much more important than that!!

    SuSE Linux - GCC 3.4.2
    XP Pro - Visual Studio 2005 TS, MinGW 3.4.2

  2. #2
    Registered User
    Join Date
    Sep 2004
    Is this dialog part of your application? If so, just save its handle into a global variable, or into a data structure you have access to. Otherwise, you can use FindWindow.

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    Sometimes accessing a modal dialog is not that easy (ie in MFC using DoModal() ) as the dialog (DoModal call) does not return until the dialog has closed.

    I find it easier to set a global variable (or local to the object that wants to send it messages, the 'caller').

    I do this in the dialogs init or create message. May require you to send in a pointer to the 'caller'. This can be done by modifing the dialogs constructor.

    Usually if you want the application to interact with the dialog, a modeless dialog is used.
    "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
    I am me, who else?
    Join Date
    Oct 2002
    I agree with novacain, better to use a modeless for true interaction with a program. It seems more suited to actually interacting with a dialog than with the more "static" dialog.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  2. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. Get a string from a modal dialog box
    By axr0284 in forum Windows Programming
    Replies: 1
    Last Post: 03-03-2005, 01:39 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM