Article ID: 177352
Article Last Modified on 11/21/2006
class CTestApp : public CWinApp
{
public:
CString m_strMyClassName;
...
}
BOOL CTestApp::InitApplication()
{
// Register our own class with the same attributes as AfxFrameOrView"
// refer to MFC Tech Note 1: Window Class Registration for more
// information.
m_strMyClassName = AfxRegisterWndClass (0, ::LoadCursor (NULL,
IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1),
LoadIcon(AFX_IDI_STD_FRAME));
return CWinApp::InitApplication();
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
CTestApp* pApp = (CTestApp*)AfxGetApp ();
// Change the class name to our own name.
cs.lpszClass = (const char *)(pApp->m_strMyClassName);
return CFrameWnd::PreCreateWindow(cs);
}
BOOL CTestView::PreCreateWindow(CREATESTRUCT& cs)
{
CTestApp* pApp = (CTestApp*)AfxGetApp ();
// Change the class name to our own name.
cs.lpszClass = (const char *)(pApp->m_strMyClassName);
return CView::PreCreateWindow(cs);
}
Keywords: kbhowto kbuidesign KB177352