Click here to Skip to main content
15,915,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: convert System::String to char * Pin
Stuart Dootson22-Jan-09 3:37
professionalStuart Dootson22-Jan-09 3:37 
AnswerRe: convert System::String to char * Pin
toxcct22-Jan-09 3:55
toxcct22-Jan-09 3:55 
AnswerRe: convert System::String to char * Pin
Sarath C22-Jan-09 4:34
Sarath C22-Jan-09 4:34 
AnswerRe: convert System::String to char * Pin
bubuzzz22-Jan-09 4:55
bubuzzz22-Jan-09 4:55 
QuestionIs there a way to view console output in the VS ide after console program ends? Pin
wsirota22-Jan-09 2:51
wsirota22-Jan-09 2:51 
AnswerRe: Is there a way to view console output in the VS ide after console program ends? Pin
Naveen22-Jan-09 2:59
Naveen22-Jan-09 2:59 
GeneralRe: Is there a way to view console output in the VS ide after console program ends? Pin
James R. Twine22-Jan-09 10:56
James R. Twine22-Jan-09 10:56 
QuestionProblem with templates by porting from vs 2003 to 2005 Pin
OwenBurnett22-Jan-09 2:29
OwenBurnett22-Jan-09 2:29 
I have a big problem porting one of my apps to VS 2005:
on one of the templates I get
"error C2906: 'const AFX_MSGMAP *CModWin<dialog>::GetThisMessageMap(void)': Explizite Spezialisierung erfordert 'Vorlage <>'" in the line BEGIN_MESSAGE_MAP(CModWin<cdialog>, CDialog)</cdialog>

the*.cpp looks like this
BEGIN_MESSAGE_MAP(CModWin<cdialog>, CDialog) 
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModWin<cresizabledialog>, CResizableDialog)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModSht<cpropertysheet>, CPropertySheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModSht<cresizablesheet>, CResizableSheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModSht<clistviewwalkerpreferencesheet>, CListViewWalkerPreferenceSheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModSht<clistviewwalkerpropertysheet>, CListViewWalkerPropertySheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModWlkSht<clistviewwalkerpreferencesheet>, CListViewWalkerPreferenceSheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CModWlkSht<clistviewwalkerpropertysheet>, CListViewWalkerPropertySheet)
	ON_COMMAND(IDOK, OnOK)
	ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
</clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></cresizablesheet></cpropertysheet></cresizabledialog></cdialog>


the *.h like this
template<class window="">
class CModWnd : public WINDOW {

public:
	CModWnd() {
		m_bDeleteOnClose = TRUE;
		m_bActive = FALSE;
	}

	void OpenDialog(UINT bDeleteOnClose = TRUE) {
		m_bDeleteOnClose = bDeleteOnClose;
		if (!m_bActive){
			m_bActive = TRUE;
			CallCreate();
		}
		ShowWindow(SW_SHOW);
		SetFocus();
	}
	virtual void CloseDialog() {
		if (m_bActive)
			DestroyWindow();
	}
	bool IsDialogOpen() { 
		return (m_bActive == TRUE); 
	}

protected:
	virtual void CallCreate() = 0;
	virtual BOOL OnInitDialog(){
		UINT old_nFlags = m_nFlags;
		m_nFlags |= WF_CONTINUEMODAL;
		BOOL bResult = WINDOW::OnInitDialog();
		m_nFlags = old_nFlags;
		return bResult;
	}
	afx_msg void OnOK()	{
		UpdateData();
		DestroyWindow();
	}
	afx_msg void OnCancel()	{
		DestroyWindow();
	}
	afx_msg void PostNcDestroy() {
		m_bActive = FALSE;
		if (m_bDeleteOnClose)
			delete this;
	}

	BOOL			m_bActive;
	BOOL			m_bDeleteOnClose;
};

template<class dialog="">
class CModWin : public CModWnd<dialog> {

public:
	CModWin(UINT nIDTemplate, CWnd* /*pParent*/ = NULL):CModWnd<dialog>(){
		m_nIDTemplate = nIDTemplate;
	}

protected:
	virtual void CallCreate() {
		Create(m_nIDTemplate, GetEmuleDlg());
	}
	DECLARE_MESSAGE_MAP()

	UINT			m_nIDTemplate;
};

template<class sheet="">
class CModSht : public CModWnd<sheet> {

public:
	CModSht():CModWnd<sheet>() {}

protected:
	virtual void CallCreate() {
		Create(GetEmuleDlg(), WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE | WS_MINIMIZEBOX);
	}
	virtual BOOL OnInitDialog(){
		// Modeless property sheets don't have Ok and Cancel buttons by default
		// This little trick fulls the property sheet into thinking it's modal
		// during it's init, so that it doesn't disable the Ok and Cancel buttons
		BOOL old_bModeless = m_bModeless;
		m_bModeless = FALSE;
		BOOL bResult = CModWnd<sheet>::OnInitDialog();
		m_bModeless = old_bModeless;
		return bResult;
	}
	afx_msg void OnOK()	{
		SendMessage(WM_COMMAND, ID_APPLY_NOW);
		CModWnd<sheet>::OnOK();
	}
	DECLARE_MESSAGE_MAP()
};

template<class wlk_sheet="">
class CModWlkSht : public CModSht<wlk_sheet> {

public:
	CModWlkSht(CListCtrlItemWalk* pListCtrl):CModSht<wlk_sheet>() {
		m_pListCtrl = pListCtrl;
	}

	void DropControl() {
		m_pListCtrl = NULL; 
		m_bDeleteOnClose = TRUE; 
		if(!IsDialogOpen()) 
			delete this;
	}
protected:
	DECLARE_MESSAGE_MAP()
};

typedef CModWin<cdialog> CModDialog;
typedef CModWin<cresizabledialog> CModResizableDialog;
typedef CModSht<cpropertysheet> CModPropertySheet;
typedef CModSht<cresizablesheet> CModResizableSheet;
typedef CModWlkSht<clistviewwalkerpreferencesheet> CModListViewWalkerPreferenceSheet;
typedef CModWlkSht<clistviewwalkerpropertysheet> CModListViewWalkerPropertySheet;
</clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></cresizablesheet></cpropertysheet></cresizabledialog></cdialog></wlk_sheet></wlk_sheet></class></sheet></sheet></sheet></sheet></class></dialog></dialog></class></class>


the whole project is available on NeoMule.sf.net


Any ideas how I can fix this anoying problem?
AnswerRe: Problem with templates by porting from vs 2003 to 2005 Pin
Stuart Dootson22-Jan-09 3:16
professionalStuart Dootson22-Jan-09 3:16 
GeneralRe: Problem with templates by porting from vs 2003 to 2005 [modified] Pin
OwenBurnett22-Jan-09 3:29
OwenBurnett22-Jan-09 3:29 
GeneralRe: Problem with templates by porting from vs 2003 to 2005 Pin
Stuart Dootson22-Jan-09 3:42
professionalStuart Dootson22-Jan-09 3:42 
GeneralRe: Problem with templates by porting from vs 2003 to 2005 Pin
OwenBurnett22-Jan-09 7:42
OwenBurnett22-Jan-09 7:42 
GeneralRe: Problem with templates by porting from vs 2003 to 2005 Pin
Stuart Dootson22-Jan-09 8:48
professionalStuart Dootson22-Jan-09 8:48 
QuestionSetWindowText does not display char '&' Pin
Member 74686122-Jan-09 1:55
Member 74686122-Jan-09 1:55 
AnswerRe: SetWindowText does not display char '&' Pin
Nishad S22-Jan-09 1:59
Nishad S22-Jan-09 1:59 
AnswerRe: SetWindowText does not display char '&' Pin
Naveen22-Jan-09 2:01
Naveen22-Jan-09 2:01 
AnswerRe: SetWindowText does not display char '&' Pin
Member 74686122-Jan-09 2:04
Member 74686122-Jan-09 2:04 
QuestionStarting a service with standard (no admin) user rights Pin
Stefan Spenz22-Jan-09 1:26
Stefan Spenz22-Jan-09 1:26 
AnswerRe: Starting a service with standard (no admin) user rights Pin
«_Superman_»22-Jan-09 1:39
professional«_Superman_»22-Jan-09 1:39 
GeneralRe: Starting a service with standard (no admin) user rights Pin
Stefan Spenz22-Jan-09 1:54
Stefan Spenz22-Jan-09 1:54 
AnswerRe: Starting a service with standard (no admin) user rights Pin
Hamid_RT22-Jan-09 19:09
Hamid_RT22-Jan-09 19:09 
QuestionHelp with project on Visual Studio C++ 2008 Pin
Member 186284622-Jan-09 1:22
Member 186284622-Jan-09 1:22 
AnswerRe: Help with project on Visual Studio C++ 2008 Pin
Sarath C22-Jan-09 4:36
Sarath C22-Jan-09 4:36 
QuestionSetLayeredWindowAttributes and bitmaps Pin
dj440022-Jan-09 1:20
dj440022-Jan-09 1:20 
AnswerRe: SetLayeredWindowAttributes and bitmaps Pin
Nishad S22-Jan-09 1:30
Nishad S22-Jan-09 1:30 

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.