0
votes

I have a SDI application and I would like to display a dialog after selecting a popup menu item to call it My dialog class is defined as:

class Dialog:public CDialogEx
{};

and an added function to view class named OnCallDlg does something as simple as:

void CAppView::OnCallDlg()
{
   Dialog d;
   d.DoModal();

}

But there is nothing shown up after I choose an item in the popup menu when rightmouse clicking the view.

1
Do you handle the WM_COMMAND message corresponding to the selected item in the context menu? Where are you calling the OnCallDlg function?Cody Gray
Yes, I do it via add-function wizard and on the CAppView class, the debug shows I reach the call DoModal, only that it returns me -1. By the way, I am using VS10.Mr.DayDreamer
Yeah, as Hans indicates, you forgot to actually create the dialog to be shown.Cody Gray

1 Answers

0
votes

You have to attach the ID to your dialog using following pattern:

Dialog d(ID_DIG); d.doModal();