Click here to Skip to main content
15,892,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What is the difference among the OnClose(),OnDestroy() and the DestroyWindow()? Pin
Ali Tavakol28-Sep-08 4:47
Ali Tavakol28-Sep-08 4:47 
AnswerRe: What is the difference among the OnClose(),OnDestroy() and the DestroyWindow()? Pin
Michael Dunn28-Sep-08 12:34
sitebuilderMichael Dunn28-Sep-08 12:34 
Questionreading text file Pin
nomi khan27-Sep-08 12:55
nomi khan27-Sep-08 12:55 
AnswerRe: reading text file Pin
David Crow27-Sep-08 16:40
David Crow27-Sep-08 16:40 
AnswerRe: reading text file Pin
Hamid_RT29-Sep-08 7:31
Hamid_RT29-Sep-08 7:31 
QuestionMessage Queues for MFC windows classes Pin
sawerr27-Sep-08 7:51
sawerr27-Sep-08 7:51 
AnswerRe: Message Queues for MFC windows classes Pin
Mark Salsbery27-Sep-08 8:24
Mark Salsbery27-Sep-08 8:24 
GeneralRe: Message Queues for MFC windows classes Pin
sawerr27-Sep-08 9:58
sawerr27-Sep-08 9:58 
For example if we want to use Edit control in win32 app, the code will be:

hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", 
            WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 
            0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
//<a href="http://www.winprog.org/tutorial/app_one.html">http://www.winprog.org/tutorial/app_one.html</a>[<a href="http://www.winprog.org/tutorial/app_one.html" target="_blank" title="New Window">^</a>]

Here we create a "control". That control has a message loop in its source code which was written by controls developer. If an event happens, it is sent to its module(for example user32.dll) not to our application. It sends to our program a notification.
OK.

But in MFC, We use CEditView which is derived from CView. So we create a new window.
And CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",...) is in the CEditView.
Has that view window got a message loop too?
If no, how can we handle for example WM_CLOSE

//class CTextView : public CEditView

void CTextView::OnClose()
{
	// TODO: Add your message handler code here and/or call default

	CEditView::OnClose();
}


You said:

Mark Salsbery wrote:
The CWinApp class derives from CWinThread, so for an MFC GUI app,
your required CWinApp object generally provides the first/main
message loop


If view window has a message loop, is that mean it is created by a new thread?

For example, When user close this CeditView window, is this message sent to Main Window or View Window?
If it is sent to main window, does main window route it to view window?

I'm sorry, i really don't solve/understand the mechanism...

Thank you.
GeneralRe: Message Queues for MFC windows classes Pin
Mark Salsbery27-Sep-08 10:08
Mark Salsbery27-Sep-08 10:08 
GeneralRe: Message Queues for MFC windows classes Pin
sawerr27-Sep-08 10:46
sawerr27-Sep-08 10:46 
Questionan always-wrong password Pin
Joseph Marzbani27-Sep-08 4:50
Joseph Marzbani27-Sep-08 4:50 
AnswerRe: an always-wrong password Pin
Paul Conrad27-Sep-08 7:18
professionalPaul Conrad27-Sep-08 7:18 
AnswerRe: an always-wrong password Pin
Iain Clarke, Warrior Programmer27-Sep-08 11:23
Iain Clarke, Warrior Programmer27-Sep-08 11:23 
QuestionHow to decode a wav file Pin
ice87111727-Sep-08 4:04
ice87111727-Sep-08 4:04 
JokeRe: How to decode a wav file Pin
followait27-Sep-08 4:11
followait27-Sep-08 4:11 
GeneralRe: How to decode a wav file Pin
Joseph Marzbani27-Sep-08 4:54
Joseph Marzbani27-Sep-08 4:54 
QuestionRe: How to decode a wav file [modified] Pin
CPallini27-Sep-08 6:04
mveCPallini27-Sep-08 6:04 
AnswerRe: How to decode a wav file Pin
Hamid_RT29-Sep-08 7:28
Hamid_RT29-Sep-08 7:28 
AnswerRe: How to decode a wav file Pin
Hamid_RT29-Sep-08 7:27
Hamid_RT29-Sep-08 7:27 
QuestionPrint all the running Applications using C++, win APIs. Pin
Subrat 470826627-Sep-08 1:16
Subrat 470826627-Sep-08 1:16 
AnswerRe: Print all the running Applications using C++, win APIs. Pin
CPallini27-Sep-08 1:21
mveCPallini27-Sep-08 1:21 
GeneralRe: Print all the running Applications using C++, win APIs. Pin
Subrat 470826627-Sep-08 2:46
Subrat 470826627-Sep-08 2:46 
GeneralRe: Print all the running Applications using C++, win APIs. Pin
CPallini27-Sep-08 3:28
mveCPallini27-Sep-08 3:28 
GeneralRe: Print all the running Applications using C++, win APIs. Pin
Subrat 470826627-Sep-08 3:51
Subrat 470826627-Sep-08 3:51 
AnswerRe: Print all the running Applications using C++, win APIs. Pin
Mark Salsbery27-Sep-08 8:45
Mark Salsbery27-Sep-08 8:45 

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.