For almost 20 year I've been developing an MFC MDI application. It has worked on Windows 98, Windows XP and Windows 7. But it fails on Windows 10... Any ideas, why? Here is the code:
class CEdytorDocFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CEdytorDocFrame)
public:
CSplitterWnd m_wndSplitter;
CSplitterWnd m_wndSplitter2;
CStatusBar m_wndStatusBar;
}
IMPLEMENT_DYNCREATE(CEdytorDocFrame, CMDIChildWnd)
CEdytorDocFrame::CEdytorDocFrame() :
m_nOldCY(0),
m_nOldEditH(1),
m_nOldViewH(1),
m_nOldEditMinH(0),
m_nOldViewMinH(0)
{
} // CEdytorDocFrame::CEdytorDocFrame()
BOOL CEdytorDocFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CDebug::WriteLog("CEdytorDocFrame::OnCreateClient(), enter");
/*
** Create status bar
*/
if(!m_wndStatusBar.CreateEx(this, SBT_TOOLTIPS | SBARS_SIZEGRIP) ||
!m_wndStatusBar.SetIndicators(indicators, countof(indicators)))
{
TRACE0("Failed to create status bar\n");
return FALSE;
}
CDebug::WriteLog("CEdytorDocFrame::OnCreateClient(), status bar created");
/*
** Calculate heights and widths
*/
int wndW, wndH, treeW, treeH, viewW, editW;
wndW = lpcs->cx;
m_nOldCY = wndH = lpcs->cy;
// Set tree pane to be 1/4 of total width and maximum height
treeW = wndW/4;
treeH = 0;
// Set edit pane to be 4/7 height of edit window and maximum width
m_nOldEditH = MulDiv(wndH, 4, 7);
editW = 0;
// Set preview pane to be 3/7 height of edit window and maximum width
m_nOldViewH = wndH-m_nOldEditH;
viewW = 0;
CDebug::WriteLog("CEdytorDocFrame::OnCreateClient() wndW=%d, wndH=%d, treeW=%d, treeH=%d, viewW=%d, editW=%d",
wndW, wndH, treeW, treeH, viewW, editW);
// Create panels
if(!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create static splitter\n");
return FALSE;
}
CDebug::WriteLog("CEdytorDocFrame::OnCreateClient(), 1st splitter created");
Last WriteLog()
does not get executed, so I suspect some problem with CreateStatic()
... But why on Windows 10 only?