Dialog based application VC++ programming


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.
Who is Participating?
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
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;
umaiyerAuthor Commented:
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.

AndyAinscowFreelance programmer / ConsultantCommented:
>>>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.
Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.