How to create a view in SDI MFC application.
- From: "free2cric@xxxxxxxxx" <free2cric@xxxxxxxxx>
- Date: 20 Mar 2006 02:11:19 -0800
Hi,
I am removing my view in OnFileNew (at the startup) . There is not
requirement of the view.. instead I put a dialog OnFIleNew which open
after checking a flag if its a startup or in the middle processing of
the application..
void CMymfcApp::OnFileNew()
{
CFrameWnd *pWnd = (CFrameWnd *)m_pMainWnd;
ASSERT_KINDOF(CFrameWnd, pWnd);
CMymfcView *pView=(CMymfcView *)pWnd->SendMessage(WM_CREATE);
ASSERT_KINDOF(CMymfcView,pView);
pView->UpdateWindow();
pView->DestroyWindow();
}
I put grey color in view just to have proper display for the view
(which just appears for the fraction of a second)
void CMymfcView::OnDraw(CDC* pDC)
{
CMymfcDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rc;
GetClientRect(&rc);
HGDIOBJ hOldBrush =
pDC->SelectObject(GetSysColorBrush(COLOR_3DSHADOW));
pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATCOPY);
pDC->SelectObject(hOldBrush);
}
Now there is no view.
Now when I bring windows explorer or some other window in front of my
frame, and I again switch back to my application, the grey color is
gone and the display is not proper so I want to create a view when
application (frame) gets focus, so its ondraw event gets fired and grey
color comes back.
But I dotn know how to create a view in SDI mfc application from the
function
void CMainFrame::OnSetFocus(CWnd* pOldWnd)
ANybody please suggest.
Thanks,
Cric.
.
- Follow-Ups:
- Re: How to create a view in SDI MFC application.
- From: Tom Serface
- Re: How to create a view in SDI MFC application.
- Prev by Date: Re: Toolbar strange behaviour
- Next by Date: Re: CView Background
- Previous by thread: ShellExecute().......Quiet urgent..........
- Next by thread: Re: How to create a view in SDI MFC application.
- Index(es):
Relevant Pages
|