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. Code: // PpSelectDn.h : header file // #include "isodirbrowser.h" #include "IsoCommonCtl.h" ///////////////////////////////////////////////////////////////////////////// // CPpSelectDn dialog class 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: [B]virtual BOOL OnInitDialog();[/B] DECLARE_MESSAGE_MAP() }; ------------------------------------------------------------------------------------ Code: // 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 handlers [B]BOOL CPpSelectDn::OnInitDialog() [/B] { CPropertyPage::OnInitDialog(); SetFontDynamically(this); AfxMessageBox(L"Simple message box."); if (m_pInfo->sdn.lpstrTabText) { TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; tcItem.pszText = (LPTSTR) m_pInfo->sdn.lpstrTabText; ((CPropertySheet*)GetParent())->GetTabControl()->SetItem(0, &tcItem ); } m_edtBrowserPrompt.SetWindowText(m_pInfo->sdn.lpstrPrompt); m_ctlBrowser.SetIsoDirInfo(1,(long)(m_pInfo->sdn.nSSLMode)); m_ctlBrowser.SetDefaultFolderFilter(m_pInfo->sdn.lpstrFolderFilter); m_ctlBrowser.SetSplitMode(FALSE); m_ctlBrowser.AddDirectory( m_pInfo->sdn.lpstrTopUrl, m_pInfo->sdn.lpstrBindUser, m_pInfo->sdn.lpstrBindPassword); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCXf Property Pages should return FALSE } BOOL CPpSelectDn::OnApply() { BOOL bResult = FALSE; long lCount = m_ctlBrowser.GetSelectedCount(0); if (lCount > 0) { CString csDn = m_ctlBrowser.GetSelectedUrl(0, 0); _tcsncpy(m_pInfo->sdn.lpstrDn, csDn, m_pInfo->sdn.iMaxDn); bResult = TRUE; } else { MessageBox(_T("You must select a directory node or cancel.")); } if (bResult) { bResult = CPropertyPage::OnApply(); } return bResult; } ------------------------------------------------------------------------------------ Code: // IsoCommonCtl.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "IsoGenUtils.h" #include "IsoCommonCtl.h" #include "DlgPromptName.h" #include "PpSelectDn.h" #include "PpEntryEditor.h" #include "IsoGenericMfc.h" #include "DlgFilterEditor.h" #include "DlgEditReq.h" ISOCOMMONCTL_DECL BOOL GetDistinguishedName(LPSELECTDN lpsdn) { BOOL bResult = FALSE; if (lpsdn->cbSize == sizeof(SELECTDN)) { CString csTitle(lpsdn->lpstrTitle); if (csTitle.GetLength() == 0) { csTitle = _T("Browse Directory Folders"); } CSetModuleHelp modHelp(g_hInstDll); CPropertySheet sheet(csTitle); CPpSelectDn::CContextInfo ctx; ctx.sdn = *lpsdn; if (!ctx.sdn.lpstrPrompt) { ctx.sdn.lpstrPrompt = _T("Select a folder:"); } [B] CPpSelectDn pageSelect(&ctx); GenUtilLoadPropPage(g_hInstDll, &pageSelect, pageSelect.IDD); sheet.m_psh.dwFlags |= PSH_HASHELP; sheet.AddPage(&pageSelect); if (sheet.DoModal() == IDOK)[/B] { _tcsncpy(lpsdn->lpstrDn, ctx.sdn.lpstrDn, lpsdn->iMaxDn); bResult = TRUE; } } return bResult; } Can anyone please help me in understanding why OnInitDialog function of CPpSelectDn class is not getting called when sheet.DoModal() is called? Am I missing something? This used to call OnInitDialog function of CPpSelectDn class correctly when sheet.DoModal() is called with Visual studio 6.0.