Click here to Skip to main content
16,005,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Small Error Pin
Graham Shanks4-Aug-06 14:02
Graham Shanks4-Aug-06 14:02 
QuestionVisual Studio Question Pin
JKallen4-Aug-06 12:17
JKallen4-Aug-06 12:17 
AnswerRe: Visual Studio Question Pin
Michael Dunn4-Aug-06 13:41
sitebuilderMichael Dunn4-Aug-06 13:41 
AnswerRe: Visual Studio Question Pin
Steve Weeks4-Aug-06 17:35
Steve Weeks4-Aug-06 17:35 
QuestionVisual Studio 2003 Debugger and Execptions [modified] Pin
kpeng14-Aug-06 11:39
kpeng14-Aug-06 11:39 
AnswerRe: Visual Studio 2003 Debugger and Execptions [modified] Pin
kpeng18-Aug-06 12:41
kpeng18-Aug-06 12:41 
QuestionHow does AfxGetApp() work? Pin
Ali Tavakol4-Aug-06 11:28
Ali Tavakol4-Aug-06 11:28 
AnswerRe: How does AfxGetApp() work? Pin
PJ Arends4-Aug-06 16:39
professionalPJ Arends4-Aug-06 16:39 
AfxWin1.inl:
_AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
	{ return afxCurrentWinApp; }

AfxWin.h:
#define afxCurrentWinApp    AfxGetModuleState()->m_pCurrentWinApp

AfxGetModuleState() returns a pointer to a MFC internal state structure.

AppCore.cpp:
CWinApp::CWinApp(LPCTSTR lpszAppName)
{
...
	// initialize CWinApp state
	ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
	pModuleState->m_pCurrentWinApp = this;
	ASSERT(AfxGetApp() == this);

...
}


So basicly the AfxGetApp() pointer is setup in the CWinApp constructor. If you really want to know the internals of MFC then thge best place to look is in the MFC source files. Using the visual studio debugger to step through the sources is the best way.



You may be right
I may be crazy
-- Billy Joel --


Within you lies the power for good, use it!!!
AnswerRe: How does AfxGetApp() work? Pin
Joe Woodbury4-Aug-06 16:40
professionalJoe Woodbury4-Aug-06 16:40 
Question"hard-wired" in C++ Pin
Jay034-Aug-06 10:10
Jay034-Aug-06 10:10 
AnswerRe: "hard-wired" in C++ Pin
RChin4-Aug-06 11:14
RChin4-Aug-06 11:14 
AnswerRe: "hard-wired" in C++ Pin
Ravi Bhavnani4-Aug-06 11:53
professionalRavi Bhavnani4-Aug-06 11:53 
AnswerRe: "hard-wired" in C++ Pin
Rilhas6-Aug-06 3:39
Rilhas6-Aug-06 3:39 
QuestionVisual Studio Net 2003 does not catch divide by zero with doubles Pin
kpeng14-Aug-06 6:45
kpeng14-Aug-06 6:45 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
Zac Howland4-Aug-06 7:03
Zac Howland4-Aug-06 7:03 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
Chris Losinger4-Aug-06 7:04
professionalChris Losinger4-Aug-06 7:04 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles [modified] Pin
Sarath C4-Aug-06 7:09
Sarath C4-Aug-06 7:09 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
David Crow4-Aug-06 7:50
David Crow4-Aug-06 7:50 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
kpeng14-Aug-06 8:14
kpeng14-Aug-06 8:14 
GeneralRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
Zac Howland4-Aug-06 8:36
Zac Howland4-Aug-06 8:36 
AnswerRe: Visual Studio Net 2003 does not catch divide by zero with doubles Pin
Joe Woodbury4-Aug-06 16:42
professionalJoe Woodbury4-Aug-06 16:42 
Questionbad pointer Pin
jon-804-Aug-06 6:15
professionaljon-804-Aug-06 6:15 
QuestionRe: bad pointer Pin
David Crow4-Aug-06 6:32
David Crow4-Aug-06 6:32 
AnswerRe: bad pointer Pin
jon-804-Aug-06 6:53
professionaljon-804-Aug-06 6:53 
GeneralRe: bad pointer Pin
David Crow4-Aug-06 7:16
David Crow4-Aug-06 7: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.