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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

Dialog box does not display

Hi,

I'm implementing an About dialog box that is generated from a IE
specific toolbar addin. The resource file looks like this:

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTDLG DIALOGEX 0, 0, 186, 95
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TRANSPARENT
CAPTION "About the toolbar"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",1,61,56,50,14
    GROUPBOX        "",IDC_STATIC,5,2,174,86,BS_CENTER | BS_FLAT
    CTEXT           "\nWish this worked",
                    IDC_STATIC,12,13,160,63,SS_SUNKEN | WS_BORDER,
                    WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
END

//////////////
I've used the ATL Wizard to generate the
dialog resource as follows:

// AboutDlg.h : Declaration of the CAboutDlg

#ifndef __ABOUTDLG_H_
#define __ABOUTDLG_H_

//commented this out #include <windows.h>
#include "resource.h"       // main symbols
#include <atlhost.h>

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg
class CAboutDlg :
     public CDialogImpl <CAboutDlg> //modified this to CWindow from
CAboutDlg
{
     

public:
     CAboutDlg(){};
     virtual ~CAboutDlg(){};

     
     enum { IDD = IDD_ABOUTDLG };

BEGIN_MSG_MAP(AboutDlg)
     MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
     
     COMMAND_ID_HANDLER(IDOK, OnOK)

END_MSG_MAP()
//LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled);
//LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
bHandled);
// Handler prototypes:
//LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl,
BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
     


     LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
     {          
                   
          MessageBox(_T("The About Dialog Box has been invoked"), _T("About
Dialog Message Box"), MB_OK);
          MessageBox("I am here", "", MB_OK);
         

          return 1;   //let the system set the focus
           
     }


     LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
bHandled)
     {
          EndDialog(wID);
          return 0;
     }

};

#endif //__ABOUTDLG_H_

I then called this class as follows:

CAboutDlg about;
about.DoModal();


The application compiles and runs, (the message boxes display as well), however the About dialog does not
display the IDD_ABOUTDLG resource in the background - the part of the
webpage that is meant to be covered by the About dialog appears
instead.

I'm really puzzled by this issue and am wondering if anyone
has run into this issue before? How did you solve it?

Any advice would be appreciated,
Suni
0
stitch2802
Asked:
stitch2802
  • 3
  • 2
1 Solution
 
Jaime OlivaresCommented:
I don't see a WS_VISIBLE style in your dialog resource, also try to remove the DS_ like styles
0
 
stitch2802Author Commented:
After adding the WS_VISIBLE option to my resource file and removing the DS_3DLOOK option as you suggested, the dialog box still did not display.

Any further suggestions? =)
0
 
Jaime OlivaresCommented:
your dialog constructor must be something like:
 CAboutDlg() : : CDialog(CAboutDlg::IDD, NULL)
{

};
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
stitch2802Author Commented:
Jaime,

Thank you for your quick response. I'm using ATL instead of MFC  to create a modal dialog box.

Will your suggestion still be applicable? Please let me know.

Thanks,
S/.
0
 
stitch2802Author Commented:
This is what MSDN had to say about it:

To create a modal dialog box, create an instance of your CDialogImpl-derived (or CAxDialogImpl-derived) class and then call the DoModal method.

Which was exactly what I did...

0
 
moduloCommented:
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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