Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: datas between dialogs Pin
valikac2-Nov-04 5:25
valikac2-Nov-04 5:25 
GeneralRe: datas between dialogs Pin
David Crow2-Nov-04 7:05
David Crow2-Nov-04 7:05 
GeneralRe: datas between dialogs Pin
toxcct18-Nov-04 23:30
toxcct18-Nov-04 23:30 
GeneralRe: datas between dialogs Pin
David Crow19-Nov-04 2:44
David Crow19-Nov-04 2:44 
GeneralShow methods at programming Pin
dancindoc2-Nov-04 3:13
dancindoc2-Nov-04 3:13 
GeneralRe: Show methods at programming Pin
David Crow2-Nov-04 3:32
David Crow2-Nov-04 3:32 
GeneralCBUTTON in MFC Pin
madretierra2-Nov-04 3:10
madretierra2-Nov-04 3:10 
GeneralRe: CBUTTON in MFC Pin
Cedric Moonen2-Nov-04 3:20
Cedric Moonen2-Nov-04 3:20 
GeneralRe: CBUTTON in MFC Pin
madretierra2-Nov-04 3:26
madretierra2-Nov-04 3:26 
GeneralRe: CBUTTON in MFC Pin
faroqtam2-Nov-04 11:41
faroqtam2-Nov-04 11:41 
GeneralRe: CBUTTON in MFC Pin
madretierra3-Nov-04 5:49
madretierra3-Nov-04 5:49 
GeneralRe: Use Clipboard in MFC Application Pin
David Crow2-Nov-04 2:22
David Crow2-Nov-04 2:22 
GeneralRe: Use Clipboard in MFC Application Pin
sweep1232-Nov-04 4:12
sweep1232-Nov-04 4:12 
GeneralRe: Use Clipboard in MFC Application Pin
David Crow2-Nov-04 4:51
David Crow2-Nov-04 4:51 
QuestionApp exit? Pin
Larsson2-Nov-04 1:43
Larsson2-Nov-04 1:43 
AnswerRe: App exit? Pin
Kapoor Vikrant2-Nov-04 1:59
Kapoor Vikrant2-Nov-04 1:59 
GeneralRe: App exit? Pin
Larsson2-Nov-04 2:02
Larsson2-Nov-04 2:02 
GeneralRe: App exit? Pin
Larsson2-Nov-04 2:23
Larsson2-Nov-04 2:23 
GeneralRe: App exit? Pin
RChin2-Nov-04 2:36
RChin2-Nov-04 2:36 
GeneralRe: App exit? Pin
Larsson2-Nov-04 2:41
Larsson2-Nov-04 2:41 
GeneralRe: App exit? Pin
RChin2-Nov-04 3:02
RChin2-Nov-04 3:02 
The OnOK(), OnCancel() and OnClose() functions are merly handlers for messages that gets sent when your button (I am assuming these are linked to a button) gets pressed. The previous poster mentioned creating a handler function for the WM_ENDSESSION message. This could be one possible solution to your problem.

My solution uses the fact that the WinApp::ExitInstance() function gets called whenever the user choses to exit their windows session.

Every MFC application should have a WinApp derived class, called something like MyProgApp, or something similar with the App appended to your class name.

Now this function isn't visible by default, so you need to override this function using the Classwizard (if using VS6), or the properties window (if using VS7.1).

You can then write your logging code within the function, but remember to call the base class at the end (or your app won't exit).


int CMyApp::ExitInstance() 
{
	// CLEANUP STUFF
	delete m_pVarA;
	delete m_pVarB;	
        ::CoUninitialize();

	return CWinApp::ExitInstance(); // base class
}





I Dream of Absolute Zero

GeneralRe: App exit? Pin
GDavy2-Nov-04 2:46
GDavy2-Nov-04 2:46 
GeneralRe: App exit? Pin
Larsson2-Nov-04 2:49
Larsson2-Nov-04 2:49 
GeneralRe: App exit? Pin
Antony M Kancidrowski2-Nov-04 4:18
Antony M Kancidrowski2-Nov-04 4:18 
GeneralRe: App exit? Pin
Larsson2-Nov-04 4:51
Larsson2-Nov-04 4:51 

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.