Click here to Skip to main content
15,902,445 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: PlaySound Usage Pin
Manjunath S10-Jul-06 2:10
Manjunath S10-Jul-06 2:10 
GeneralRe: PlaySound Usage Pin
Ștefan-Mihai MOGA10-Jul-06 2:53
professionalȘtefan-Mihai MOGA10-Jul-06 2:53 
QuestionRe: PlaySound Usage Pin
David Crow10-Jul-06 3:00
David Crow10-Jul-06 3:00 
QuestionWin32 application Pin
Anu_Bala10-Jul-06 0:24
Anu_Bala10-Jul-06 0:24 
AnswerRe: Win32 application Pin
RockyJames10-Jul-06 0:31
RockyJames10-Jul-06 0:31 
AnswerRe: Win32 application Pin
ThatsAlok10-Jul-06 1:29
ThatsAlok10-Jul-06 1:29 
AnswerRe: Win32 application Pin
David Crow10-Jul-06 3:09
David Crow10-Jul-06 3:09 
AnswerRe: Win32 application Pin
Zac Howland10-Jul-06 4:54
Zac Howland10-Jul-06 4:54 
Anu_Bala wrote:
CMainFrame::CMainFrame()
{
Create(NULL, "MFC Fundamentals");
}


Do not call Create from within the constructor. You will be trying to use objects that haven't been fully initialized yet. Instead, make your constructor empty and call Create in InitInstance:

#include "stdafx.h"

class CExerciseApp : public CWinApp
{
public:
	virtual BOOL InitInstance();
};

class CMainFrame : public CFrameWnd
{
public:
	CMainFrame();
};

CMainFrame::CMainFrame()
{
}

BOOL CExerciseApp::InitInstance()
{
	CMainFrame* pFrame = new CMainFrame;
	pFrame->Create(NULL, _T("My Non-AppWizard MFC App"));
	m_pMainWnd = pFrame;
	m_pMainWnd->ShowWindow(SW_NORMAL);
	return TRUE;
}

CExerciseApp theApp;


If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
QuestionBasic Doubt in CMutex Class. Pin
Uday Janaswamy10-Jul-06 0:23
Uday Janaswamy10-Jul-06 0:23 
AnswerRe: Basic Doubt in CMutex Class. Pin
Zac Howland10-Jul-06 4:56
Zac Howland10-Jul-06 4:56 
GeneralRe: Basic Doubt in CMutex Class. Pin
Uday Janaswamy10-Jul-06 18:43
Uday Janaswamy10-Jul-06 18:43 
GeneralRe: Basic Doubt in CMutex Class. Pin
Zac Howland11-Jul-06 2:38
Zac Howland11-Jul-06 2:38 
Questionmodeless dialog almost solved Pin
Desmo1610-Jul-06 0:22
Desmo1610-Jul-06 0:22 
AnswerRe: modeless dialog almost solved Pin
Desmo1610-Jul-06 1:08
Desmo1610-Jul-06 1:08 
QuestionRe: modeless dialog almost solved Pin
David Crow10-Jul-06 3:10
David Crow10-Jul-06 3:10 
AnswerRe: modeless dialog almost solved Pin
Desmo1610-Jul-06 3:56
Desmo1610-Jul-06 3:56 
Questionsystem restarting by itself Pin
Tara1410-Jul-06 0:09
Tara1410-Jul-06 0:09 
AnswerRe: system restarting by itself Pin
pgrohs10-Jul-06 1:39
pgrohs10-Jul-06 1:39 
GeneralRe: system restarting by itself Pin
Tara1410-Jul-06 1:44
Tara1410-Jul-06 1:44 
GeneralRe: system restarting by itself Pin
pgrohs10-Jul-06 1:50
pgrohs10-Jul-06 1:50 
GeneralRe: system restarting by itself Pin
Tara1410-Jul-06 1:53
Tara1410-Jul-06 1:53 
GeneralRe: system restarting by itself Pin
pgrohs10-Jul-06 1:59
pgrohs10-Jul-06 1:59 
GeneralRe: system restarting by itself Pin
Tara1410-Jul-06 2:01
Tara1410-Jul-06 2:01 
GeneralRe: system restarting by itself Pin
Tara1410-Jul-06 2:08
Tara1410-Jul-06 2:08 
GeneralRe: system restarting by itself Pin
pgrohs10-Jul-06 2:16
pgrohs10-Jul-06 2:16 

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.