I got this to work as follows - if anyone can see something wrong with this, please let me know, as I know with MFC that sometimes even if you get something to work, it is not necessarilly right an could cause problems later
BOOL CMainFrame::DestroyWindow()
{
int currentLeftWidth;
int minLeftWidth;
int currentRightWidth;
int minRightWidth;
try
{
m_wndSplitter.GetColumnInfo( 0, currentLeftWidth, minLeftWidth );
m_wndSplitter.GetColumnInfo( 1, currentRightWidth, minRightWidth );
AfxGetApp()->WriteProfileInt(_T("BWE"), _T("LeftPaneWidth"), currentLeftWidth);
AfxGetApp()->WriteProfileInt(_T("BWE"), _T("RightPaneWidth"), currentRightWidth);
}
catch ( ... )
{
AfxMessageBox(_T("Could not save splitter bar position to registry"));
}
CWnd::DestroyWindow();
return true;
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT ,
CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE;
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(AfxGetApp()->GetProfileInt(_T("BWE"), _T("LeftPaneWidth"), 50), 100), pContext) ||
!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CBWEView), CSize(AfxGetApp()->GetProfileInt(_T("BWE"), _T("RightPaneWidth"), 50), 100), pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
}