Click here to Skip to main content
15,905,414 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: STL / Custom Linked List Pin
Blake Miller3-Sep-10 12:30
Blake Miller3-Sep-10 12:30 
GeneralRe: STL / Custom Linked List Pin
Luc Pattyn3-Sep-10 14:52
sitebuilderLuc Pattyn3-Sep-10 14:52 
AnswerRe: STL / Custom Linked List PinPopular
Maximilien30-Aug-10 13:43
Maximilien30-Aug-10 13:43 
AnswerRe: STL / Custom Linked List Pin
Emilio Garavaglia30-Aug-10 20:04
Emilio Garavaglia30-Aug-10 20:04 
Questionre:looking for winsock listener tcp c++ example that supports multiple potential clients Pin
Alan Kurlansky30-Aug-10 11:05
Alan Kurlansky30-Aug-10 11:05 
AnswerRe: re:looking for winsock listener tcp c++ example that supports multiple potential clients Pin
Fareed Rizkalla30-Aug-10 11:10
Fareed Rizkalla30-Aug-10 11:10 
AnswerRe: re:looking for winsock listener tcp c++ example that supports multiple potential clients Pin
Moak30-Aug-10 12:00
Moak30-Aug-10 12:00 
QuestionOnInitDialog is not getting called from DoModal in VS2005 [modified] Pin
funwithdolphin30-Aug-10 2:49
funwithdolphin30-Aug-10 2:49 
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 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:
	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 handlers

BOOL CPpSelectDn::OnInitDialog() 
{
	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;
}
------------------------------------------------------------------------------------
// 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:");
		}

		CPpSelectDn pageSelect(&ctx);
		GenUtilLoadPropPage(g_hInstDll, &pageSelect, pageSelect.IDD);

		sheet.m_psh.dwFlags |= PSH_HASHELP;
		sheet.AddPage(&pageSelect);

		if (sheet.DoModal() == IDOK)
		{
			_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.

modified on Monday, August 30, 2010 10:24 AM

AnswerRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
Richard MacCutchan30-Aug-10 4:05
mveRichard MacCutchan30-Aug-10 4:05 
AnswerRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
Eugen Podsypalnikov30-Aug-10 4:30
Eugen Podsypalnikov30-Aug-10 4:30 
GeneralRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
funwithdolphin30-Aug-10 5:24
funwithdolphin30-Aug-10 5:24 
GeneralRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
Eugen Podsypalnikov30-Aug-10 5:29
Eugen Podsypalnikov30-Aug-10 5:29 
GeneralRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
funwithdolphin31-Aug-10 3:51
funwithdolphin31-Aug-10 3:51 
GeneralRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
funwithdolphin31-Aug-10 21:53
funwithdolphin31-Aug-10 21:53 
GeneralRe: OnInitDialog is not getting called from DoModal in VS2005 Pin
funwithdolphin31-Aug-10 23:24
funwithdolphin31-Aug-10 23:24 
QuestionReplace exe in Install shield Pin
raju_shiva30-Aug-10 0:33
raju_shiva30-Aug-10 0:33 
AnswerRe: Replace exe in Install shield Pin
ThatsAlok30-Jun-11 23:59
ThatsAlok30-Jun-11 23:59 
QuestionHow to achieve pushbutton type effect using bitmaps Pin
sayonee29-Aug-10 22:23
sayonee29-Aug-10 22:23 
AnswerRe: How to achieve pushbutton type effect using bitmaps Pin
Sauro Viti30-Aug-10 6:43
professionalSauro Viti30-Aug-10 6:43 
QuestionMultiple includes Pin
Shy Agam29-Aug-10 21:49
Shy Agam29-Aug-10 21:49 
AnswerRe: Multiple includes Pin
Cedric Moonen29-Aug-10 22:38
Cedric Moonen29-Aug-10 22:38 
AnswerRe: Multiple includes Pin
CPallini29-Aug-10 22:46
mveCPallini29-Aug-10 22:46 
GeneralRe: Multiple includes Pin
Shy Agam29-Aug-10 23:06
Shy Agam29-Aug-10 23:06 
GeneralRe: Multiple includes Pin
Cedric Moonen29-Aug-10 23:53
Cedric Moonen29-Aug-10 23:53 
GeneralRe: Multiple includes [modified] Pin
Shy Agam30-Aug-10 0:10
Shy Agam30-Aug-10 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.