Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

No main window

Hi experts,

I have written following simplest MFC program.
It has no problems in compiling as well as linking.
But when I run the program, I don't see any window.
Any problem in VC++ settings?
I am using VC++ 6.0 Enterprise Edition.

#include <afxwin.h>
class CMainWin : public CFrameWnd
{
public:
     CMainWin();
     DECLARE_MESSAGE_MAP()
};

CMainWin::CMainWin()
{
     Create(NULL,"MFC");
}
class CApp : public CWinApp
{
public:
     BOOL InitInstace();
};

BOOL CApp::InitInstace()
{
     m_pMainWnd=new CMainWin;
     m_pMainWnd->ShowWindow(m_nCmdShow);
     m_pMainWnd->UpdateWindow();
     return TRUE;
}
BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd)
END_MESSAGE_MAP()
CApp App;
0
sumant032199
Asked:
sumant032199
1 Solution
 
AlexFMCommented:
Write InitInstance instead of InitInstace.
0
 
keitha1Commented:
Good eyes, AlemFM
0
 
sumant032199Author Commented:
Thanks.

Virtual functions are nasty!
I spent 2 hours hunting the bug.
This example has confirmed that C++ does a lot many things
which programmer has not told it explicitely to do.

Thanks a lot, AlexFM.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now