dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: SDI and a popup dialog

  1. #1
    Join Date
    May 2008
    Posts
    36

    Arrow SDI and a popup dialog

    I have a dialog class defined as

    class MyDialogublic CDialogEx
    {};

    and I'd like to call up the dialog after a right mouse click on the view of a SDI application

    The menu is shown after the right mouse click but there is no dialog displayed after I select its item "call dialog".

    void MyApplicatioView::OnDisplayDlg()
    {
    MyDialog d;
    INT i=d.DoModal();
    }

    'i' always gets the value of -1.

    Would you helo me please ?
    Thank you

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,208

    Re: SDI and a popup dialog

    Please post code using code tags and post the code that shows the MESSAGE_MAP entries.

  3. #3
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: SDI and a popup dialog

    Quote Originally Posted by ChayKieu View Post
    void MyApplicatioView::OnDisplayDlg()
    {
    MyDialog d;
    INT i=d.DoModal();
    }

    'i' always gets the value of -1.
    From MSDN:
    The return value is 1 if the function could not create the dialog box, or IDABORT if some other error occurred, in which case the Output window will contain error information from GetLastError.
    So what is the output window telling you?

    Common causes for this error is when the dialog resource cannot be found. This happens when another resource dll is loaded. Or when one of the controls on the dialog cannot be created. Temporarily set 'no fail create' to yes in the properties of the dialog resource to find out which control is the cause.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  4. #4
    Join Date
    May 2008
    Posts
    36

    Re: SDI and a popup dialog

    Thank you, problem resolved, I forgot to add an afx.... in the initinstance before the control on the dialog is used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)