OnInitDialog is not getting called from DoModal in VS2005 [modified]
-
Hi, I am porting code from VS 6.0 to VS2005. However I am seeing that OnInitDialog() function is not getting called from DoModal() in VS2005. I already tried adding breakpoints and messagebox to see if OnInitDialog function of CPpSelectDn class is getting called. However I found that it is not getting called.
// PpSelectDn.h : header file
//
#include "isodirbrowser.h"
#include "IsoCommonCtl.h"/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn dialogclass CPpSelectDn : public CPropertyPage
{
DECLARE_DYNCREATE(CPpSelectDn)public:
class CContextInfo
{
public:
SELECTDN sdn;
};// Construction
public:
CContextInfo* m_pInfo;
CPpSelectDn();
CPpSelectDn(CContextInfo *pInfo);
~CPpSelectDn();// Dialog Data
//{{AFX_DATA(CPpSelectDn)
enum { IDD = IDD_ISOCMN_SELECTDN };
CStatic m_edtBrowserPrompt;
CString m_csBrowserPrompt;
CIsoDirBrowser m_ctlBrowser;
//}}AFX_DATA// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPpSelectDn)
public:
virtual BOOL OnApply();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()};
// PpSelectDn.cpp : implementation file
//#include "stdafx.h"
#include "resource.h"
#include "PpSelectDn.h"
#include "IsoGenericMfc.h"
IMPLEMENT_DYNCREATE(CPpSelectDn, CPropertyPage)CPpSelectDn::CPpSelectDn() :
CPropertyPage(CPpSelectDn::IDD)
{
}CPpSelectDn::CPpSelectDn(CContextInfo *pInfo) :
CPropertyPage(CPpSelectDn::IDD),
m_pInfo(pInfo)
{
//{{AFX_DATA_INIT(CPpSelectDn)
m_csBrowserPrompt = _T("");
}CPpSelectDn::~CPpSelectDn()
{
}void CPpSelectDn::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPpSelectDn)
DDX_Control(pDX, IDC_ISOCMN_SELDNPROMPT, m_edtBrowserPrompt);
DDX_Text(pDX, IDC_ISOCMN_SELDNPROMPT, m_csBrowserPrompt);
DDX_Control(pDX, IDC_ISOCMN_DIRBROWSER, m_ctlBrowser);
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CPpSelectDn, CPropertyPage)
//{{AFX_MSG_MAP(CPpSelectDn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn message handlersBOOL CPpSelectDn::OnInitDialog()
{
CPropertyPage::OnInitDialog();
SetFontDynamically(this -
Hi, I am porting code from VS 6.0 to VS2005. However I am seeing that OnInitDialog() function is not getting called from DoModal() in VS2005. I already tried adding breakpoints and messagebox to see if OnInitDialog function of CPpSelectDn class is getting called. However I found that it is not getting called.
// PpSelectDn.h : header file
//
#include "isodirbrowser.h"
#include "IsoCommonCtl.h"/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn dialogclass CPpSelectDn : public CPropertyPage
{
DECLARE_DYNCREATE(CPpSelectDn)public:
class CContextInfo
{
public:
SELECTDN sdn;
};// Construction
public:
CContextInfo* m_pInfo;
CPpSelectDn();
CPpSelectDn(CContextInfo *pInfo);
~CPpSelectDn();// Dialog Data
//{{AFX_DATA(CPpSelectDn)
enum { IDD = IDD_ISOCMN_SELECTDN };
CStatic m_edtBrowserPrompt;
CString m_csBrowserPrompt;
CIsoDirBrowser m_ctlBrowser;
//}}AFX_DATA// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPpSelectDn)
public:
virtual BOOL OnApply();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()};
// PpSelectDn.cpp : implementation file
//#include "stdafx.h"
#include "resource.h"
#include "PpSelectDn.h"
#include "IsoGenericMfc.h"
IMPLEMENT_DYNCREATE(CPpSelectDn, CPropertyPage)CPpSelectDn::CPpSelectDn() :
CPropertyPage(CPpSelectDn::IDD)
{
}CPpSelectDn::CPpSelectDn(CContextInfo *pInfo) :
CPropertyPage(CPpSelectDn::IDD),
m_pInfo(pInfo)
{
//{{AFX_DATA_INIT(CPpSelectDn)
m_csBrowserPrompt = _T("");
}CPpSelectDn::~CPpSelectDn()
{
}void CPpSelectDn::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPpSelectDn)
DDX_Control(pDX, IDC_ISOCMN_SELDNPROMPT, m_edtBrowserPrompt);
DDX_Text(pDX, IDC_ISOCMN_SELDNPROMPT, m_csBrowserPrompt);
DDX_Control(pDX, IDC_ISOCMN_DIRBROWSER, m_ctlBrowser);
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CPpSelectDn, CPropertyPage)
//{{AFX_MSG_MAP(CPpSelectDn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn message handlersBOOL CPpSelectDn::OnInitDialog()
{
CPropertyPage::OnInitDialog();
SetFontDynamically(this -
Hi, I am porting code from VS 6.0 to VS2005. However I am seeing that OnInitDialog() function is not getting called from DoModal() in VS2005. I already tried adding breakpoints and messagebox to see if OnInitDialog function of CPpSelectDn class is getting called. However I found that it is not getting called.
// PpSelectDn.h : header file
//
#include "isodirbrowser.h"
#include "IsoCommonCtl.h"/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn dialogclass CPpSelectDn : public CPropertyPage
{
DECLARE_DYNCREATE(CPpSelectDn)public:
class CContextInfo
{
public:
SELECTDN sdn;
};// Construction
public:
CContextInfo* m_pInfo;
CPpSelectDn();
CPpSelectDn(CContextInfo *pInfo);
~CPpSelectDn();// Dialog Data
//{{AFX_DATA(CPpSelectDn)
enum { IDD = IDD_ISOCMN_SELECTDN };
CStatic m_edtBrowserPrompt;
CString m_csBrowserPrompt;
CIsoDirBrowser m_ctlBrowser;
//}}AFX_DATA// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPpSelectDn)
public:
virtual BOOL OnApply();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()};
// PpSelectDn.cpp : implementation file
//#include "stdafx.h"
#include "resource.h"
#include "PpSelectDn.h"
#include "IsoGenericMfc.h"
IMPLEMENT_DYNCREATE(CPpSelectDn, CPropertyPage)CPpSelectDn::CPpSelectDn() :
CPropertyPage(CPpSelectDn::IDD)
{
}CPpSelectDn::CPpSelectDn(CContextInfo *pInfo) :
CPropertyPage(CPpSelectDn::IDD),
m_pInfo(pInfo)
{
//{{AFX_DATA_INIT(CPpSelectDn)
m_csBrowserPrompt = _T("");
}CPpSelectDn::~CPpSelectDn()
{
}void CPpSelectDn::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPpSelectDn)
DDX_Control(pDX, IDC_ISOCMN_SELDNPROMPT, m_edtBrowserPrompt);
DDX_Text(pDX, IDC_ISOCMN_SELDNPROMPT, m_csBrowserPrompt);
DDX_Control(pDX, IDC_ISOCMN_DIRBROWSER, m_ctlBrowser);
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CPpSelectDn, CPropertyPage)
//{{AFX_MSG_MAP(CPpSelectDn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CPpSelectDn message handlersBOOL CPpSelectDn::OnInitDialog()
{
CPropertyPage::OnInitDialog();
SetFontDynamically(thisNormally
CPropertySheet::DoModal()
does load the added Pages from the resource module (that is currently set for the application), "some other" loaded modules will be also iterated to find them; but the page can not be found there, I think... :) What role has theGenUtilLoadPropPage()
, please ?virtual void BeHappy() = 0;
-
Normally
CPropertySheet::DoModal()
does load the added Pages from the resource module (that is currently set for the application), "some other" loaded modules will be also iterated to find them; but the page can not be found there, I think... :) What role has theGenUtilLoadPropPage()
, please ?virtual void BeHappy() = 0;
GenUtilLoadPropPage loads the Property Page having pageSelect.IDD. When I debugged, it was able to find the resource needed and FindResource() was successful. Wonder why it still does not call the OnInitDialog of CPpSelectDn class though.
ISOGENUTILS_DECL void GenUtilLoadPropPage(HINSTANCE hInst, CPropertyPage *pPage, int /*UINT*/ nIDTemplate)
{
ASSERT(hInst);
HRSRC hResInfo = ::FindResource(hInst, (LPCTSTR)nIDTemplate, (LPCTSTR)RT_DIALOG);
ASSERT(hResInfo);
HGLOBAL hDialogTemplate = ::LoadResource(hInst, hResInfo);
ASSERT(hDialogTemplate);
LPCDLGTEMPLATE pTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
ASSERT(pTemplate);
pPage->m_psp.dwFlags |= PSP_DLGINDIRECT;
pPage->m_psp.pResource = pTemplate;
pPage->SetHelpID(LOWORD((DWORD)nIDTemplate));
} -
GenUtilLoadPropPage loads the Property Page having pageSelect.IDD. When I debugged, it was able to find the resource needed and FindResource() was successful. Wonder why it still does not call the OnInitDialog of CPpSelectDn class though.
ISOGENUTILS_DECL void GenUtilLoadPropPage(HINSTANCE hInst, CPropertyPage *pPage, int /*UINT*/ nIDTemplate)
{
ASSERT(hInst);
HRSRC hResInfo = ::FindResource(hInst, (LPCTSTR)nIDTemplate, (LPCTSTR)RT_DIALOG);
ASSERT(hResInfo);
HGLOBAL hDialogTemplate = ::LoadResource(hInst, hResInfo);
ASSERT(hDialogTemplate);
LPCDLGTEMPLATE pTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
ASSERT(pTemplate);
pPage->m_psp.dwFlags |= PSP_DLGINDIRECT;
pPage->m_psp.pResource = pTemplate;
pPage->SetHelpID(LOWORD((DWORD)nIDTemplate));
}// When I debugged, it was able to find the resource needed and FindResource() was successful. Was it in the context of the
GenUtilLoadPropPage
(is?) orCPropertySheet::DoModal()
(should :)) ? Just set a break point at theDoModal()
and then debug inside (by F11) :)virtual void BeHappy() = 0;
-
// When I debugged, it was able to find the resource needed and FindResource() was successful. Was it in the context of the
GenUtilLoadPropPage
(is?) orCPropertySheet::DoModal()
(should :)) ? Just set a break point at theDoModal()
and then debug inside (by F11) :)virtual void BeHappy() = 0;
I debugged. I see that it calls 'INT_PTR CPropertySheet:: DoModal()' which internally calls CPropertySheet::OnInitDialog(). Here is the stack trace in case this helps you in pointing out any clues: Code:
> mfc80u.dll!CPropertySheet::OnInitDialog() Line 1437 C++
mfc80u.dll!CPropertySheet::HandleInitDialog(unsigned int __formal=1052816, unsigned int __formal=1052816) Line 1455 C++
mfc80u.dll!CWnd::OnWndMsg(unsigned int message=272, unsigned int wParam=1052816, long lParam=1519392, long * pResult=0x00129744) Line 2194 + 0x8 bytes C++
mfc80u.dll!CWnd::WindowProc(unsigned int message=272, unsigned int wParam=1052816, long lParam=1519392) Line 1741 + 0x17 bytes C++
mfc80u.dll!AfxCallWndProc(CWnd * pWnd=0x84c820c4, HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 243 C++
mfc80u.dll!AfxWndProc(HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 388 + 0x10 bytes C++
mfc80u.dll!AfxWndProcBase(HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 411 + 0x16 bytes C++
USER32.DLL!77e3a454()
[Frames below may be incorrect and/or missing, no symbols loaded for USER32.DLL]
USER32.DLL!77e14750()
USER32.DLL!77e155b0()
NTDLL.DLL!77f91baf()
USER32.DLL!77e16408()
USER32.DLL!77e29da0()
USER32.DLL!77e2cc1e()
USER32.DLL!77e3ed99()
SHLWAPI.DLL!70a9af09()
comctl32.dll!7176b0d7()
comctl32.dll!7174b366()
mfc80u.dll!AfxPropPageCallback(HWND__ * __formal=0x00000000, unsigned int message=0, _PROPSHEETPAGEW * pPropPage=0x00174648) Line 52 + 0x5 bytes C++
comctl32.dll!7174b959()
comctl32.dll!7174b5ef()
comctl32.dll!7174b601()
mfc80u.dll!CComCtlWrapper::_PropertySheetW(const _PROPSHEETHEADERW * unnamed1=0x00129bc4) Line 342 + 0x6e bytes C++
mfc80u.dll!CPropertySheet::DoModal() Line 961 C++
IsoGenU.dll!GetDistinguishedName(tagSELECTDN * lpsdn=0x0012a800) Line 137 + 0xb bytes C++I also saw that CPropertyPage::OnSetActive() was called by CPropertySheet:: DoModal(). As can be seen above, CPropertySheet::OnInitDialog() is getting called. However, OnInitDialog function of CPpSelectDn class is not getting called.
-
I debugged. I see that it calls 'INT_PTR CPropertySheet:: DoModal()' which internally calls CPropertySheet::OnInitDialog(). Here is the stack trace in case this helps you in pointing out any clues: Code:
> mfc80u.dll!CPropertySheet::OnInitDialog() Line 1437 C++
mfc80u.dll!CPropertySheet::HandleInitDialog(unsigned int __formal=1052816, unsigned int __formal=1052816) Line 1455 C++
mfc80u.dll!CWnd::OnWndMsg(unsigned int message=272, unsigned int wParam=1052816, long lParam=1519392, long * pResult=0x00129744) Line 2194 + 0x8 bytes C++
mfc80u.dll!CWnd::WindowProc(unsigned int message=272, unsigned int wParam=1052816, long lParam=1519392) Line 1741 + 0x17 bytes C++
mfc80u.dll!AfxCallWndProc(CWnd * pWnd=0x84c820c4, HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 243 C++
mfc80u.dll!AfxWndProc(HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 388 + 0x10 bytes C++
mfc80u.dll!AfxWndProcBase(HWND__ * hWnd=0x00171098, unsigned int nMsg=272, unsigned int wParam=1052816, long lParam=1519392) Line 411 + 0x16 bytes C++
USER32.DLL!77e3a454()
[Frames below may be incorrect and/or missing, no symbols loaded for USER32.DLL]
USER32.DLL!77e14750()
USER32.DLL!77e155b0()
NTDLL.DLL!77f91baf()
USER32.DLL!77e16408()
USER32.DLL!77e29da0()
USER32.DLL!77e2cc1e()
USER32.DLL!77e3ed99()
SHLWAPI.DLL!70a9af09()
comctl32.dll!7176b0d7()
comctl32.dll!7174b366()
mfc80u.dll!AfxPropPageCallback(HWND__ * __formal=0x00000000, unsigned int message=0, _PROPSHEETPAGEW * pPropPage=0x00174648) Line 52 + 0x5 bytes C++
comctl32.dll!7174b959()
comctl32.dll!7174b5ef()
comctl32.dll!7174b601()
mfc80u.dll!CComCtlWrapper::_PropertySheetW(const _PROPSHEETHEADERW * unnamed1=0x00129bc4) Line 342 + 0x6e bytes C++
mfc80u.dll!CPropertySheet::DoModal() Line 961 C++
IsoGenU.dll!GetDistinguishedName(tagSELECTDN * lpsdn=0x0012a800) Line 137 + 0xb bytes C++I also saw that CPropertyPage::OnSetActive() was called by CPropertySheet:: DoModal(). As can be seen above, CPropertySheet::OnInitDialog() is getting called. However, OnInitDialog function of CPpSelectDn class is not getting called.
Here is what I did with VS6.0: - As I mentioned earlier, it was working fine with VS6.0. So What I did now is , I created a fresh VS6.0 setup on a new machine and built the code. But when I tested, again I was facing same display problem as I was getting with VS2005. However, I saw below warnings in the VS6.0 output window:
CoCreateInstance of OLE control {395262A9-51B1-11D2-BA1B-00A02489AC7A} failed.
Result code: 0x800401f0
Is the control is properly registered?
Warning: CreateDlgControls failed during dialog init.So I registered the IsoDirB.ocx file using regsvr32.exe manually. Then when I tested the application with VS6.0, it worked correctly and the UI problem with Directory browser display was not there and everything worked just nicely. So this meant that if IsoDirB.ocx control is not registered, then I see UI problem with Directory browser display. ------------------------------------------------------------------- From above findings, I also registered the IsoDirB.ocx file using regsvr32.exe manually on VS2005 machine too. It didn't give any error when I registered IsoDirB.ocx using regsvr32.exe on VS2005 machine. Then when I tested the application. However, I am still seeing the same display problem with Directory browser display with VS2005. I see below warnings in the VS2005 output window:
'mm.exe': Loaded 'C:\Program Files\CriticalPath\Manager\IsoDirB.ocx', No symbols loaded.
First-chance exception at 0x77fac57c in mm.exe: 0xC0000139: Entry Point Not Found.
'mm.exe': Unloaded 'C:\Program Files\CriticalPath\Manager\IsoDirB.ocx'I am not sure how much important/relevance above warning has with the UI problem; but this might be important. I remember I made changes in build of IsoDirB.ocx code project and not sure if it is causing this first chance exception. Any inputs on investigating about this "Entry Point Not Found" warning are highly appreciated.
-
Here is what I did with VS6.0: - As I mentioned earlier, it was working fine with VS6.0. So What I did now is , I created a fresh VS6.0 setup on a new machine and built the code. But when I tested, again I was facing same display problem as I was getting with VS2005. However, I saw below warnings in the VS6.0 output window:
CoCreateInstance of OLE control {395262A9-51B1-11D2-BA1B-00A02489AC7A} failed.
Result code: 0x800401f0
Is the control is properly registered?
Warning: CreateDlgControls failed during dialog init.So I registered the IsoDirB.ocx file using regsvr32.exe manually. Then when I tested the application with VS6.0, it worked correctly and the UI problem with Directory browser display was not there and everything worked just nicely. So this meant that if IsoDirB.ocx control is not registered, then I see UI problem with Directory browser display. ------------------------------------------------------------------- From above findings, I also registered the IsoDirB.ocx file using regsvr32.exe manually on VS2005 machine too. It didn't give any error when I registered IsoDirB.ocx using regsvr32.exe on VS2005 machine. Then when I tested the application. However, I am still seeing the same display problem with Directory browser display with VS2005. I see below warnings in the VS2005 output window:
'mm.exe': Loaded 'C:\Program Files\CriticalPath\Manager\IsoDirB.ocx', No symbols loaded.
First-chance exception at 0x77fac57c in mm.exe: 0xC0000139: Entry Point Not Found.
'mm.exe': Unloaded 'C:\Program Files\CriticalPath\Manager\IsoDirB.ocx'I am not sure how much important/relevance above warning has with the UI problem; but this might be important. I remember I made changes in build of IsoDirB.ocx code project and not sure if it is causing this first chance exception. Any inputs on investigating about this "Entry Point Not Found" warning are highly appreciated.
It is working fine now. I unregistered the ocx control, then rebuilt the control and then registered it with regsvr32.exe. Now OnInitDialog of CPpSelectDn is getting called. Also, the UI controls for LDAP directory browse are shown correctly on the page. It looks like earlier it had old incorrect version of ocx file registered, which needed unregistering and reregistering the new one. ;)