Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help Needed! Pin
ThatsAlok5-Jun-06 1:48
ThatsAlok5-Jun-06 1:48 
GeneralRe: Help Needed! Pin
Tara145-Jun-06 1:55
Tara145-Jun-06 1:55 
GeneralRe: Help Needed! Pin
ThatsAlok5-Jun-06 1:58
ThatsAlok5-Jun-06 1:58 
GeneralRe: Help Needed! Pin
Tara145-Jun-06 2:05
Tara145-Jun-06 2:05 
QuestionHandle exit Pin
DanYELL4-Jun-06 10:14
DanYELL4-Jun-06 10:14 
AnswerRe: Handle exit [modified] Pin
Stephen Hewitt4-Jun-06 13:57
Stephen Hewitt4-Jun-06 13:57 
AnswerRe: Handle exit Pin
Michael Dunn4-Jun-06 16:26
sitebuilderMichael Dunn4-Jun-06 16:26 
AnswerRe: Handle exit Pin
Nibu babu thomas4-Jun-06 17:35
Nibu babu thomas4-Jun-06 17:35 
Check for WM_SYSCOMMAND and then SC_CLOSE.

When you click on those buttons on the title bar a WM_SYSCOMMAND is generated. Now what kind of event happened is determined by the wParam parameter. Check the wParam parameter to find out if X (SC_CLOSE) was clicked.

Here is a sample done with WindowProc...

LRESULT CVolMacDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	if( message == WM_SYSCOMMAND && wParam == SC_CLOSE )
	{
		if( MessageBox(_T( "Are you sure you want to quit?" ), _T( "Prompt?" ), MB_YESNO ) == IDNO)
			return 0;
	}
		
	return CDialog::WindowProc(message, wParam, lParam);
}
Well this is done with a dialog, it will work with views too but it will require some additional housekeeping too. Hope this helps.


Nibu thomas
A Developer

Programming tips[^]  My site[^]

GeneralRe: Handle exit Pin
FarPointer4-Jun-06 20:49
FarPointer4-Jun-06 20:49 
QuestionMinimize application from taskbar Pin
Junyor4-Jun-06 8:20
Junyor4-Jun-06 8:20 
AnswerRe: Minimize application from taskbar Pin
Nibu babu thomas4-Jun-06 17:37
Nibu babu thomas4-Jun-06 17:37 
GeneralRe: Minimize application from taskbar Pin
helpcode4-Jun-06 23:51
helpcode4-Jun-06 23:51 
QuestionRe: Minimize application from taskbar Pin
NianHawk17-Jun-06 5:08
NianHawk17-Jun-06 5:08 
AnswerRe: print a bitmap Pin
Hamid_RT4-Jun-06 7:12
Hamid_RT4-Jun-06 7:12 
QuestionHow to lock taskbar in my program Pin
NianHawk4-Jun-06 3:08
NianHawk4-Jun-06 3:08 
AnswerRe: How to lock taskbar in my program Pin
Nibu babu thomas4-Jun-06 18:13
Nibu babu thomas4-Jun-06 18:13 
GeneralRe: How to lock taskbar in my program Pin
NianHawk7-Jun-06 6:38
NianHawk7-Jun-06 6:38 
GeneralRe: How to lock taskbar in my program Pin
Nibu babu thomas7-Jun-06 17:38
Nibu babu thomas7-Jun-06 17:38 
QuestionRe: How to lock taskbar in my program Pin
NianHawk7-Jun-06 19:22
NianHawk7-Jun-06 19:22 
AnswerRe: How to lock taskbar in my program Pin
Nibu babu thomas7-Jun-06 19:30
Nibu babu thomas7-Jun-06 19:30 
QuestionRe: How to lock taskbar in my program Pin
NianHawk17-Jun-06 5:01
NianHawk17-Jun-06 5:01 
AnswerRe: How to lock taskbar in my program Pin
Nibu babu thomas18-Jun-06 17:19
Nibu babu thomas18-Jun-06 17:19 
GeneralRe: How to lock taskbar in my program Pin
NianHawk20-Jun-06 6:39
NianHawk20-Jun-06 6:39 
QuestionDrawing to desktop Pin
Aneurysm004-Jun-06 2:20
Aneurysm004-Jun-06 2:20 
AnswerRe: Drawing to desktop Pin
ThatsAlok4-Jun-06 19:11
ThatsAlok4-Jun-06 19: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.