BOOL CSyxPosApp::InitInstance()
{
...
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame; // create and load the frame with its resources pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow(); return TRUE;
}内存泄露,DEBUG信息中提示就是CMainFrame* pFrame = new CMainFrame;这条语句引起的,请问如何释放pFrame申请的内存和资源?我这样修改了,好像不行:int CSyxPosApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
delete m_pMainWnd; return CWinApp::ExitInstance();
}
请大家帮忙指点一下!
解决方案 »
- VC++如何使用JPEG和DIB类库在指定的图像控件(IDC_PIC)上显示jpg图片,各位知道的请帮帮忙,谢谢!!
- 刚从VC6.0转VS2005,在MFC的使用方面遇到了一些麻烦事
- 请教如何按照某个图片来设计对话框的边界?
- 奇怪啊。。。MFC诡异问题。。。。
- 奇怪,为什么进不去『类似Visio的图形软件终于发布了,高兴散分200』?
- listview的窗口中怎么才能实现整行被选中以及出现一条条的分割线
- 内存 SPD 问题??????
- 老师:帮我看看这是什么错误啊?
- 為什麽我的client端程序報錯!!
- 项目属性为应用程序 却生成lib文件与exp文件(DLL的)
- 如何下载MMS流媒体文件?
- cwinthread成员变量m_bAutoDelete的疑惑
为什么不行呢?是不是类型不对,一个MainWnd,一个MainFrame?
pFrame = NULL;试试看
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CXXXDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CXXXView));
AddDocTemplate(pDocTemplate);//CSingleDcoTemplate会初始化CMainFrame类的成员m_pMainWnd, 然后再进行后面的操作:
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();也就是说你的初始化错误了