Link to home
Start Free TrialLog in
Avatar of caiman23
caiman23

asked on

Showing dialogs. Very, very easy.

I have made a dialog with the resource editor.
What code do I have to add in order to show it? (for instance, when the user clicks a button in another dialog)
ASKER CERTIFIED SOLUTION
Avatar of kakamna
kakamna

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of caiman23
caiman23

ASKER

So, I create a dialog and I give the name CDlgNewSC to the new class.
I have another dialog, and I want to open the new one by clicking on a button named NewSC (in the old dialog). So I have this:

void CFhgDlg::OnNewSC()
//CFhgDlg: old dialog
{
      CDlgNewSC dlg;
      dlg.DoModal();
}


But of course I get the message "CDlgNewSC undeclared identifier", because both dialogs come from CDialog, but they dont know each other...
What can I do?
So, I create a dialog and I give the name CDlgNewSC to the new class.
I have another dialog, and I want to open the new one by clicking on a button named NewSC (in the old dialog). So I have this:

void CFhgDlg::OnNewSC()
//CFhgDlg: old dialog
{
      CDlgNewSC dlg;
      dlg.DoModal();
}


But of course I get the message "CDlgNewSC undeclared identifier", because both dialogs come from CDialog, but they dont know each other...
What can I do?
//////////////////////////
void CFhgDlg::OnNewSC()
//CFhgDlg: old dialog
{
CDlgNewSC dlg;
dlg.DoModal();
}
////////////////////////////


In whatever file you have the code abhove include the header file  of the file where CDlgNewSC  class is defined.

ie

#include "DlgNewSC.h"


You are done

niraj





ghimireniraj is rite.