Click here to Skip to main content
15,914,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Does anyone know of universal naming convention (UNC) path? Pin
Chris Richardson22-Jan-03 19:10
Chris Richardson22-Jan-03 19:10 
Generalhelp needed Pin
BORICUA22-Jan-03 16:30
BORICUA22-Jan-03 16:30 
GeneralRelative Path not available in startup Pin
fordge22-Jan-03 15:21
fordge22-Jan-03 15:21 
GeneralRe: Relative Path not available in startup Pin
Chris Richardson22-Jan-03 19:16
Chris Richardson22-Jan-03 19:16 
GeneralRe: Relative Path not available in startup Pin
fordge23-Jan-03 14:08
fordge23-Jan-03 14:08 
GeneralRe: Relative Path not available in startup Pin
Chris Richardson24-Jan-03 6:47
Chris Richardson24-Jan-03 6:47 
GeneralRe: Relative Path not available in startup Pin
jimNLX24-Jan-03 10:44
jimNLX24-Jan-03 10:44 
GeneralWhy does the following code call the same Dialog box twice? <Long> Pin
VanHlebar22-Jan-03 13:52
VanHlebar22-Jan-03 13:52 
Why does the following code show the Same Dialog Box twice? The code for the Dialog boxes in inside a dll and the call to the CreateCharacter() is called from the main application. The problem is that the application only shows the first dialog box, even though the "Testing" message box does appear. This tells me that the application is call the correct class, but not showing the correct dialog box.

Thanks for any help you can give.

#include "StdAfx.h"<br />
#include "ExportedFunctionsCVNChar.h"<br />
#include "NewChar1.h"<br />
#include "NewChar2.h"<br />
<br />
DLLEXPORT BOOL CreateNewCharacter()<br />
{<br />
	CNewChar1 dlg;<br />
	CNewChar2 dlg2;<br />
	int nResult;<br />
<br />
	nResult = dlg.DoModal();<br />
	<br />
	if(nResult == IDOK)<br />
	{<br />
		nResult = dlg2.DoModal();<br />
	}<br />
<br />
	return TRUE;<br />
}<br />
////////////////////////////////////// NewChar1.h ///////////////////////////<br />
class CNewChar1 : public CDialog<br />
{<br />
// Construction<br />
public:<br />
	CNewChar1(CWnd* pParent = NULL);   // standard constructor<br />
	BOOL OnInitDialog();<br />
<br />
// Dialog Data<br />
	//{{AFX_DATA(CNewChar1)<br />
	enum { IDD = IDD_NEWCHAR1 };<br />
	CComboBox	m_cClass;<br />
	CComboBox	m_cRace;<br />
	CString	m_strAL;<br />
	int		m_nCha;<br />
	CString	m_strClass;<br />
	int		m_nCon;<br />
	int		m_nDex;<br />
	int		m_nHitPts;<br />
	int		m_nInt;<br />
	CString	m_strName;<br />
	CString	m_strRace;<br />
	int		m_nStr;<br />
	int		m_nWis;<br />
	//}}AFX_DATA<br />
<br />
<br />
// Overrides<br />
	// ClassWizard generated virtual function overrides<br />
	//{{AFX_VIRTUAL(CNewChar1)<br />
	protected:<br />
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support<br />
	//}}AFX_VIRTUAL<br />
<br />
// Implementation<br />
protected:<br />
<br />
	// Generated message map functions<br />
	//{{AFX_MSG(CNewChar1)<br />
		// NOTE: the ClassWizard will add member functions here<br />
	//}}AFX_MSG<br />
	DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
////////////////////////////////// NewChar2.h ///////////////////////////////<br />
class CNewChar2 : public CDialog<br />
{<br />
// Construction<br />
public:<br />
	CNewChar2(CWnd* pParent = NULL);   // standard constructor<br />
	BOOL OnInitDialog();<br />
// Dialog Data<br />
	//{{AFX_DATA(CNewChar2)<br />
	enum { IDD = IDD_NEWCHAR2 };<br />
	CString	m_strGender;<br />
	CString	m_strHand;<br />
	CString	m_strDeity;<br />
	CString	m_strEyeColor;<br />
	CString	m_strHairColor;<br />
	CString	m_strHeight;<br />
	int		m_nWeight;<br />
	//}}AFX_DATA<br />
<br />
<br />
// Overrides<br />
	// ClassWizard generated virtual function overrides<br />
	//{{AFX_VIRTUAL(CNewChar2)<br />
	protected:<br />
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support<br />
	//}}AFX_VIRTUAL<br />
<br />
// Implementation<br />
protected:<br />
<br />
	// Generated message map functions<br />
	//{{AFX_MSG(CNewChar2)<br />
		// NOTE: the ClassWizard will add member functions here<br />
	//}}AFX_MSG<br />
	DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
//////////////////////////////// NewChar1.cpp ///////////////////////////////<br />
CNewChar1::CNewChar1(CWnd* pParent /*=NULL*/)<br />
	: CDialog(CNewChar1::IDD, pParent)<br />
{<br />
	//{{AFX_DATA_INIT(CNewChar1)<br />
	m_strAL = _T("");<br />
	m_nCha = 0;<br />
	m_strClass = _T("");<br />
	m_nCon = 0;<br />
	m_nDex = 0;<br />
	m_nHitPts = 0;<br />
	m_nInt = 0;<br />
	m_strName = _T("");<br />
	m_strRace = _T("");<br />
	m_nStr = 0;<br />
	m_nWis = 0;<br />
	//}}AFX_DATA_INIT<br />
}<br />
<br />
<br />
void CNewChar1::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CDialog::DoDataExchange(pDX);<br />
	//{{AFX_DATA_MAP(CNewChar1)<br />
	DDX_Control(pDX, IDC_CLASS, m_cClass);<br />
	DDX_Control(pDX, IDC_RACE, m_cRace);<br />
	DDX_Text(pDX, IDC_AL, m_strAL);<br />
	DDX_Text(pDX, IDC_CHA, m_nCha);<br />
	DDV_MinMaxInt(pDX, m_nCha, 1, 99);<br />
	DDX_CBString(pDX, IDC_CLASS, m_strClass);<br />
	DDX_Text(pDX, IDC_CON, m_nCon);<br />
	DDV_MinMaxInt(pDX, m_nCon, 1, 99);<br />
	DDX_Text(pDX, IDC_DEX, m_nDex);<br />
	DDV_MinMaxInt(pDX, m_nDex, 1, 99);<br />
	DDX_Text(pDX, IDC_HITPTS, m_nHitPts);<br />
	DDV_MinMaxInt(pDX, m_nHitPts, 1, 999);<br />
	DDX_Text(pDX, IDC_INT, m_nInt);<br />
	DDV_MinMaxInt(pDX, m_nInt, 1, 99);<br />
	DDX_Text(pDX, IDC_NAME, m_strName);<br />
	DDX_CBString(pDX, IDC_RACE, m_strRace);<br />
	DDX_Text(pDX, IDC_STR, m_nStr);<br />
	DDV_MinMaxInt(pDX, m_nStr, 1, 99);<br />
	DDX_Text(pDX, IDC_WIS, m_nWis);<br />
	DDV_MinMaxInt(pDX, m_nWis, 1, 99);<br />
	//}}AFX_DATA_MAP<br />
}<br />
<br />
BOOL CNewChar1::OnInitDialog()<br />
{<br />
<br />
	CDialog::OnInitDialog();		//Always call base class first.<br />
<br />
	HINSTANCE hHandle;<br />
	LPTSTR lpStringResource = NULL;<br />
	CString strString;<br />
	UINT uResourceId;<br />
	int nResult;<br />
	BOOL bDone = FALSE;<br />
<br />
	hHandle = LoadLibrary(_T("CVPlayersHndBk.cvl"));<br />
	if(hHandle == NULL)<br />
		MessageBox(_T("Error loading CVPlayerHndBk.cvl!"), _T("Initialize Error"), MB_ICONEXCLAMATION);<br />
	else<br />
	{<br />
		//Load all the races from the Player's Handbook<br />
		uResourceId = 1000;<br />
		<br />
		while(!bDone)<br />
		{<br />
			nResult = strString.LoadString(uResourceId);// LoadString(hHandle, uResourceId, lpStringResource, 100);<br />
<br />
			if(nResult)<br />
			{<br />
				nResult = m_cRace.AddString(strString);<br />
				if(nResult == CB_ERR)<br />
				{<br />
					MessageBox(_T("Error loading Races."), _T("CVNewCharacter Error"), MB_ICONEXCLAMATION);<br />
					bDone = TRUE;<br />
				}<br />
				else<br />
				{<br />
					lpStringResource = NULL;<br />
					uResourceId++;<br />
				}<br />
			}<br />
			else<br />
			{<br />
				bDone = TRUE;<br />
			}<br />
		}<br />
<br />
		//Load all the Classes from the Player's Handbook<br />
		uResourceId = 2000;<br />
		bDone = FALSE;<br />
		strString.Empty();<br />
<br />
		while(!bDone)<br />
		{<br />
			nResult = strString.LoadString(uResourceId);// LoadString(hHandle, uResourceId, lpStringResource, 100);<br />
<br />
			if(nResult)<br />
			{<br />
				nResult = m_cClass.AddString(strString);<br />
				if(nResult == CB_ERR)<br />
				{<br />
					MessageBox(_T("Error loading Races."), _T("CVNewCharacter Error"), MB_ICONEXCLAMATION);<br />
					bDone = TRUE;<br />
				}<br />
				else<br />
				{<br />
					lpStringResource = NULL;<br />
					uResourceId++;<br />
				}<br />
			}<br />
			else<br />
			{<br />
				bDone = TRUE;<br />
			}<br />
		}<br />
<br />
	}<br />
<br />
	FreeLibrary(hHandle);				//Release the CVPlayersHndBk.cvl.<br />
<br />
	return TRUE;<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CNewChar1, CDialog)<br />
	//{{AFX_MSG_MAP(CNewChar1)<br />
		// NOTE: the ClassWizard will add message map macros here<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CNewChar1 message handlers<br />
<br />
////////////////////////////////// NewChar2.cpp /////////////////////////////<br />
CNewChar2::CNewChar2(CWnd* pParent /*= NULL*/)<br />
	: CDialog(CNewChar2::IDD, pParent)<br />
{<br />
	//{{AFX_DATA_INIT(CNewChar2)<br />
	m_strGender = _T("");<br />
	m_strHand = _T("");<br />
	m_strDeity = _T("");<br />
	m_strEyeColor = _T("");<br />
	m_strHairColor = _T("");<br />
	m_strHeight = _T("");<br />
	m_nWeight = 0;<br />
	//}}AFX_DATA_INIT<br />
}<br />
<br />
<br />
void CNewChar2::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CDialog::DoDataExchange(pDX);<br />
	//{{AFX_DATA_MAP(CNewChar2)<br />
	/*DDX_CBString(pDX, IDC_COMBO_GENDER, m_strGender);<br />
	DDX_CBString(pDX, IDC_COMBO_HAND, m_strHand);<br />
	DDX_Text(pDX, IDC_EDIT_DEITY, m_strDeity);<br />
	DDX_Text(pDX, IDC_EDIT_EYECOLOR, m_strEyeColor);<br />
	DDX_Text(pDX, IDC_EDIT_HAIRCOLOR, m_strHairColor);<br />
	DDX_Text(pDX, IDC_EDIT_HEIGHT, m_strHeight);<br />
	DDX_Text(pDX, IDC_EDIT_WEIGHT, m_nWeight);*/<br />
	//}}AFX_DATA_MAP<br />
}<br />
<br />
BOOL CNewChar2::OnInitDialog()<br />
{<br />
	CDialog::OnInitDialog();		//Always call the base class first.<br />
<br />
	MessageBox(_T("Testing"));<br />
<br />
	return TRUE;<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CNewChar2, CDialog)<br />
	//{{AFX_MSG_MAP(CNewChar2)<br />
		// NOTE: the ClassWizard will add message map macros here<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CNewChar2 message handlers<br />
<br />

GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Christian Graus22-Jan-03 14:02
protectorChristian Graus22-Jan-03 14:02 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Chris Losinger22-Jan-03 14:03
professionalChris Losinger22-Jan-03 14:03 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
VanHlebar22-Jan-03 16:07
VanHlebar22-Jan-03 16:07 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Roger Allen23-Jan-03 2:25
Roger Allen23-Jan-03 2:25 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
VanHlebar24-Jan-03 1:32
VanHlebar24-Jan-03 1:32 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Roger Allen24-Jan-03 1:57
Roger Allen24-Jan-03 1:57 
QuestionPossible with shell extensions? Pin
Anonymous22-Jan-03 13:49
Anonymous22-Jan-03 13:49 
AnswerRe: Possible with shell extensions? Pin
Lim Bio Liong22-Jan-03 17:27
Lim Bio Liong22-Jan-03 17:27 
GeneralRe: Possible with shell extensions? Pin
Anonymous23-Jan-03 4:34
Anonymous23-Jan-03 4:34 
GeneralMemory Management & Windows Messenger Pin
Mike.NET22-Jan-03 11:39
Mike.NET22-Jan-03 11:39 
GeneralRe: Memory Management & Windows Messenger Pin
John M. Drescher22-Jan-03 13:04
John M. Drescher22-Jan-03 13:04 
GeneralRe: Memory Management & Windows Messenger Pin
Mike.NET22-Jan-03 15:14
Mike.NET22-Jan-03 15:14 
GeneralResizable Property Sheets under XP Pin
Member 8408522-Jan-03 11:26
Member 8408522-Jan-03 11:26 
GeneralUser authentication Pin
lvguy197222-Jan-03 11:12
lvguy197222-Jan-03 11:12 
GeneralHelp me to Release Resources! Pin
Ehsan Baghaki22-Jan-03 11:08
Ehsan Baghaki22-Jan-03 11:08 
GeneralRe: Help me to Release Resources! Pin
Joaquín M López Muñoz22-Jan-03 11:12
Joaquín M López Muñoz22-Jan-03 11:12 
Questionhow do I make a dynamic controlbar? Pin
tobbemannen22-Jan-03 10:40
tobbemannen22-Jan-03 10:40 

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.