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

C / C++ / MFC

 
GeneralRe: Inserting an image into a view Pin
Antti Keskinen1-Feb-05 7:55
Antti Keskinen1-Feb-05 7:55 
GeneralRe: Inserting an image into a view Pin
José Luis Sogorb1-Feb-05 23:03
José Luis Sogorb1-Feb-05 23:03 
Generalint nResponse = dlg.DoModal(); Visual C++ 6.0 Pin
Close Network1-Feb-05 3:44
Close Network1-Feb-05 3:44 
GeneralRe: int nResponse = dlg.DoModal(); Visual C++ 6.0 Pin
Michael Dunn1-Feb-05 3:58
sitebuilderMichael Dunn1-Feb-05 3:58 
GeneralRe: int nResponse = dlg.DoModal(); Visual C++ 6.0 Pin
Close Network1-Feb-05 4:29
Close Network1-Feb-05 4:29 
GeneralAVL Tree insertion algorithm Pin
Sarath C1-Feb-05 3:27
Sarath C1-Feb-05 3:27 
GeneralHooked MDIChild window ---> problem Pin
Ro_land1-Feb-05 3:15
Ro_land1-Feb-05 3:15 
GeneralRe: Hooked MDIChild window ---> problem Pin
Roger Allen1-Feb-05 6:10
Roger Allen1-Feb-05 6:10 
The problem is due to the way MFC routes the messages in the OnCmdMsg() function.

BOOL CFrameWnd::OnCmdMsg(UINT nID, int nCode, void* pExtra,
	AFX_CMDHANDLERINFO* pHandlerInfo)
{
	CPushRoutingFrame push(this);

	// pump through current view FIRST
	CView* pView = GetActiveView();
	if (pView != NULL && pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	// then pump through frame
	if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	// last but not least, pump through app
	CWinApp* pApp = AfxGetApp();
	if (pApp != NULL && pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	return FALSE;
}


If you override this function in your mainframe you can add an extra stage to query the CMdiChild window.

e.g.

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra,
	AFX_CMDHANDLERINFO* pHandlerInfo)
{
	CPushRoutingFrame push(this);

	// pump through current view FIRST
	CView* pView = GetActiveView();
	if (pView != NULL)
	{
		CWnd *pParent = pView->GetParent();
		if (pParent != NULL && pParent->OnCmdMdg(nID, nCode, pExtra, pHandlerInfo))
			return TRUE;
	}
	if (pView != NULL && pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	// then pump through frame
	if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	// last but not least, pump through app
	CWinApp* pApp = AfxGetApp();
	if (pApp != NULL && pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	return FALSE;
}


If you vote me down, my score will only get lower
GeneralRe: Hooked MDIChild window ---> problem Pin
Ro_land2-Feb-05 19:19
Ro_land2-Feb-05 19:19 
GeneralAVL Tree Pin
Sarath C1-Feb-05 3:05
Sarath C1-Feb-05 3:05 
Generalextracting part of a string Pin
si_691-Feb-05 2:52
si_691-Feb-05 2:52 
GeneralRe: extracting part of a string Pin
V.1-Feb-05 3:03
professionalV.1-Feb-05 3:03 
GeneralRe: extracting part of a string Pin
Sarath C1-Feb-05 3:26
Sarath C1-Feb-05 3:26 
GeneralRe: extracting part of a string Pin
bolivar1231-Feb-05 5:32
bolivar1231-Feb-05 5:32 
GeneralRe: extracting part of a string Pin
toxcct1-Feb-05 5:52
toxcct1-Feb-05 5:52 
QuestionCaveats when using SetParent ? Pin
Maximilien1-Feb-05 1:27
Maximilien1-Feb-05 1:27 
QuestionAny example Advise Sink in C++ ? Pin
im4help1-Feb-05 1:13
im4help1-Feb-05 1:13 
Generalvc++ Pin
nowshadmc1-Feb-05 1:01
nowshadmc1-Feb-05 1:01 
GeneralIntelligent Agent Pin
SummersZone1-Feb-05 0:49
SummersZone1-Feb-05 0:49 
GeneralRe: Intelligent Agent Pin
Selvam R1-Feb-05 1:51
professionalSelvam R1-Feb-05 1:51 
GeneralGET ICON Pin
kedar.dave1-Feb-05 0:33
kedar.dave1-Feb-05 0:33 
GeneralRe: GET ICON Pin
ThatsAlok1-Feb-05 2:53
ThatsAlok1-Feb-05 2:53 
GeneralRe: GET ICON Pin
kedar.dave2-Feb-05 19:06
kedar.dave2-Feb-05 19:06 
Generalresize PropertySheet Pin
includeh101-Feb-05 0:32
includeh101-Feb-05 0:32 
GeneralRe: resize PropertySheet Pin
PJ Arends1-Feb-05 10:25
professionalPJ Arends1-Feb-05 10:25 

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.