MFC CFrameWnd Client size

drjackool 956 Reputation points
2023-07-12T04:22:24.3533333+00:00

Hi

I using MFC in my project. MFC by defaults fills window client by a just one window/control I want add extra window to my app (except toolbar and status bar) How should I override CFrameWnd::RecalcLayout() function?

Is following my code correct?

I ask this because I think RepositionBars function has overhead (like other ugly MFC stuffs!) and called twice! My app has just CReBar and CStatusBar control in top and bottom. How resize them without RepositionBars function?

thanks in advance

void CMainFrame::RecalcLayout(BOOL bNotify)
{
	CRect rectClient;
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, CWnd::reposQuery, &rectClient, NULL, TRUE);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, CWnd::reposDefault, NULL, NULL, TRUE);
// reposition other controls myself here
}
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,822 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.