[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1124
  • Last Modified:

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.
  • 2
1 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;
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.

>>>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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now