Click here to Skip to main content
15,889,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionWait for Data in pipe? Pin
peterchen2-Nov-04 1:42
peterchen2-Nov-04 1:42 
AnswerRe: Wait for Data in pipe? Pin
Blake Miller2-Nov-04 7:54
Blake Miller2-Nov-04 7:54 
QuestionHow to calculate the Bandwidth of our computer Pin
Anshul Mehra1-Nov-04 23:58
professionalAnshul Mehra1-Nov-04 23:58 
AnswerRe: How to calculate the Bandwidth of our computer Pin
Antony M Kancidrowski2-Nov-04 1:37
Antony M Kancidrowski2-Nov-04 1:37 
GeneralRe: How to calculate the Bandwidth of our computer Pin
Anshul Mehra2-Nov-04 3:20
professionalAnshul Mehra2-Nov-04 3:20 
GeneralRe: How to calculate the Bandwidth of our computer Pin
Antony M Kancidrowski2-Nov-04 4:04
Antony M Kancidrowski2-Nov-04 4:04 
AnswerRe: How to calculate the Bandwidth of our computer Pin
Selvam R2-Nov-04 2:56
professionalSelvam R2-Nov-04 2:56 
AnswerRe: How to calculate the Bandwidth of our computer Pin
ThatsAlok3-Nov-04 17:57
ThatsAlok3-Nov-04 17:57 
QuestionWhat is the defference about _T("abc") and "abc"? Pin
freehawk1-Nov-04 23:41
freehawk1-Nov-04 23:41 
AnswerRe: What is the defference about _T("abc") and "abc"? Pin
Pharago1-Nov-04 23:57
Pharago1-Nov-04 23:57 
AnswerRe: What is the defference about _T("abc") and "abc"? Pin
RChin2-Nov-04 0:13
RChin2-Nov-04 0:13 
GeneralCreating 16 color bitmap from DC Pin
Vinaya1-Nov-04 23:03
Vinaya1-Nov-04 23:03 
QuestionHow can I change a menu item when I click? Pin
lillah1-Nov-04 22:58
lillah1-Nov-04 22:58 

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.