Link to home
Start Free TrialLog in
Avatar of Imen BELTAIEF
Imen BELTAIEF

asked on

Menu Command

Hello ,
I create a menu "config" .I want to open another dialog box when I click in the menu "Config".
I make a function added to Menu ID : W_Command
Then I call it in the principal dialog box :InAccDlg ,as it shown in the code as bellow , while compiling ,the called dialogBox wasn't shown .
My code is as bellow :

void CIntAccDlg::OnIdrMenu1()
{
      CConfigDlg ConfigDlg;
      ConfigDlg.DoModal();
      ShowWindow(SW_SHOW);
}
Is there any problem !
Avatar of Zoppo
Zoppo
Flag of Germany image

Hi,

IMO there are two possibilities: either the menue handler function isn't called or the DoModal-call fails to create/show the dialog.

You can test the first if you simply add code which shows a message box (using AfxMessageBox) before the DoModal-call - if the message box isn't shown when you click the menu-item the menu handler is not called at all.

If the message box is shown the DoModal-call fails to create/show the dialog. There are cases where this can happen (i.e. when using a resource ID of a none-existing control in DoDataExchange, or because the dialog template couldn't be found/loaded, ...), but usually there should be some kind of warning/error message (either a message box with something like 'Invalid argument', or an ASSERT or some TRACE-output in the Output Window) - there's even the possibility the dialog is implemented in a way it calls EndDialog itself in some situations, but I guess you implemented the dialog class yourself, so I would assumen this is not the problem.

If this doesn't help to find the cause it will become difficult - without being able to debug in detail what's happening we can only guess.

Best regards,

ZOPPO
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.