Dialog based application VC++ programming

Posted on 2007-10-13
Last Modified: 2013-11-20

Here is the problem description.
I am working on VC++ dialog based application.
I have created 2 dialog box , IDD_DIALOG_ONE and IDD_DIALOG_TWO. I have placed few control (child controls on respective dialog box). In IDD_DIALOG_ONE  dialog box (one.cpp)i have a list control which will list the file names from the directory path which is set at different place and i have a function abc which will handle this. In   IDD_DIALOG_TWO (two.cpp) dialog box i have a button where in i will set the path to list the files. In OnButton function of two.cpp file i am not able to call the abc function of one.cpp. How to handle this problem. Can this be handled via user defined message and if so how can be done. If there is any alternate method please suggest.

Thanks in advance.
Question by:umaiyer
    LVL 43

    Accepted Solution

    If dlg2 has a pointer to dlg1 then you can use something like

    This is an example for a modal dlg2 created in dlg1.
    Somewhere in dlg1
    CDlg2 dlg(this);
    dlg2.m_pDlg1 = this;

    in the header of dlg2
    CDlg1* m_pDlg1;

    Author Comment

    Dialog box are not created using "Create" function. instead using resource. so i have 2 different dialog box and respective class created for each. different  controls are placed on   each dialog box. is there a  way to send a user defined message to dialog 1 from dialog2. how to get the dialog 1 handle in dialog 2 (two.cpp) file.

    LVL 43

    Expert Comment

    >>>Dialog box are not created using "Create" function. instead using resource.

    Irrelevant - as long as one dialog has a pointer to the other it can be done by the method I showed.
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now