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

C / C++ / MFC

 
GeneralRe: Different results when , compare 2 strings and 1 str with 1 str from file Pin
David Crow24-May-07 10:10
David Crow24-May-07 10:10 
GeneralRe: Different results when , compare 2 strings and 1 str with 1 str from file Pin
Immunity1824-May-07 10:15
Immunity1824-May-07 10:15 
Questionreading from the Microphone Pin
hamidreza_buddy24-May-07 7:39
hamidreza_buddy24-May-07 7:39 
AnswerRe: reading from the Microphone Pin
Mark Salsbery24-May-07 8:00
Mark Salsbery24-May-07 8:00 
AnswerRe: reading from the Microphone Pin
normanS24-May-07 9:08
normanS24-May-07 9:08 
Questionrelation between CMainframe and the application class Pin
prithaa24-May-07 6:12
prithaa24-May-07 6:12 
AnswerRe: relation between CMainframe and the application class Pin
David Crow24-May-07 7:08
David Crow24-May-07 7:08 
AnswerRe: relation between CMainframe and the application class Pin
Mark Salsbery24-May-07 8:12
Mark Salsbery24-May-07 8:12 
To expand on DavidCrow's excellent reply...

prithaa wrote:
in general what is the relation between a CMainframe and the application class.


They are both in the same application(?). It's up to you to provide the relationship if you need
it. Typically, the CWinThread::m_pMainWnd is set to point to your app's main window. If this
is done then the application will terminate when the main window closes.
Also, the application class is typically the thread that provides the message loop which
dispatches messages to the main window.

Unless you've passed a pointer/reference to your app class to the main window class (in which
case you could use that to call a method of the app class) then you can use AfxGetApp() to get
a pointer to the one and only app class object, something like:

CMyWinApp *pMyWinApp = DYNAMIC_DOWNCAST(CMyWinApp, AfxGetApp());
pMyWinApp->MyAppMethod(...);

"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

AnswerRe: relation between CMainframe and the application class Pin
Nelek24-May-07 21:22
protectorNelek24-May-07 21:22 
QuestionLNK2005 linking problem with libcmt.lib [modified] Pin
theboywilse24-May-07 5:41
theboywilse24-May-07 5:41 
QuestionApplication Crashes on OnBegindrag Pin
AAKAra24-May-07 5:19
AAKAra24-May-07 5:19 
QuestionAccess from thread Pin
garfield18524-May-07 5:12
garfield18524-May-07 5:12 
AnswerRe: Access from thread Pin
KellyR24-May-07 5:24
KellyR24-May-07 5:24 
GeneralRe: Access from thread Pin
garfield18524-May-07 5:38
garfield18524-May-07 5:38 
GeneralRe: Access from thread Pin
Roger Stoltz24-May-07 5:49
Roger Stoltz24-May-07 5:49 
QuestionWeird problem with bitmaps.. Pin
KellyR24-May-07 4:32
KellyR24-May-07 4:32 
Questionhow to close .exe file in process list in task manager Pin
nahitan24-May-07 4:13
nahitan24-May-07 4:13 
QuestionRe: how to close .exe file in process list in task manager Pin
David Crow24-May-07 4:19
David Crow24-May-07 4:19 
AnswerRe: how to close .exe file in process list in task manager Pin
Mark Salsbery24-May-07 6:32
Mark Salsbery24-May-07 6:32 
GeneralRe: how to close .exe file in process list in task manager Pin
nahitan24-May-07 9:41
nahitan24-May-07 9:41 
AnswerRe: how to close .exe file in process list in task manager Pin
swarup24-May-07 8:22
swarup24-May-07 8:22 
GeneralRe: how to close .exe file in process list in task manager Pin
nahitan24-May-07 9:45
nahitan24-May-07 9:45 
AnswerRe: how to close .exe file in process list in task manager Pin
Hamid_RT24-May-07 11:12
Hamid_RT24-May-07 11:12 
Questiondelete "anonymous?" string Pin
daveyerwin24-May-07 4:07
daveyerwin24-May-07 4:07 
AnswerRe: delete "anonymous?" string Pin
BadKarma24-May-07 4:11
BadKarma24-May-07 4:11 

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.