Balasubramaniam.j
March 29th, 1999, 09:57 PM
I tried to create a mdi with a menu without using appwizard
but it is displaying assertion error when i add the code of OnCreate()and when i debug it.It is displaying hMenu=-1 but
when i comment it .the mdi gets displayed but with out frame. please anyone tell me what is the mistake i have had done
mdi.cpp
#include<afxwin.h>
#include<afxext.h>
#include "resource.h"
class Win:public CWinApp
{
public:
BOOL InitInstance();
};
class Frame:public CMDIFrameWnd
{
public:
Frame();
private:
afx_msg int OnCreate(LPCREATESTRUCT lpCreatestruct);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
private:
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(Frame,CMDIFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
Frame::Frame(){
}
BOOL Frame::PreCreateWindow(CREATESTRUCT& cs)
{
return CMDIFrameWnd::PreCreateWindow(cs);
}
int Frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(!CMDIFrameWnd::OnCreate(lpCreateStruct))//this is the part causing
//error for me
return -1;
return 0;
}
BOOL Win::InitInstance()
{
Frame* f1=new Frame;
f1->LoadFrame(IDR_MENU1);
m_pMainWnd=f1;
m_pMainWnd->ShowWindow(3);
m_pMainWnd->UpdateWindow();
return TRUE;
}
Win W1;
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script1.rc
//
#define IDR_MENU1 101
#define ID_MENUITEM40001 40001
#define ID_MENUITEM40002 40002
#define ID_MENUITEM40003 40003
#define ID_MENUITEM40004 40004
#define ID_MENUITEM40005 40005
#define ID_BUTTON40006 40006
#define ID_BUTTON40007 40007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40008
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
or any one tell me How to create a MDI window with a menu without using appwizard.
Thank you
By Balasubramaniam.J
but it is displaying assertion error when i add the code of OnCreate()and when i debug it.It is displaying hMenu=-1 but
when i comment it .the mdi gets displayed but with out frame. please anyone tell me what is the mistake i have had done
mdi.cpp
#include<afxwin.h>
#include<afxext.h>
#include "resource.h"
class Win:public CWinApp
{
public:
BOOL InitInstance();
};
class Frame:public CMDIFrameWnd
{
public:
Frame();
private:
afx_msg int OnCreate(LPCREATESTRUCT lpCreatestruct);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
private:
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(Frame,CMDIFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
Frame::Frame(){
}
BOOL Frame::PreCreateWindow(CREATESTRUCT& cs)
{
return CMDIFrameWnd::PreCreateWindow(cs);
}
int Frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(!CMDIFrameWnd::OnCreate(lpCreateStruct))//this is the part causing
//error for me
return -1;
return 0;
}
BOOL Win::InitInstance()
{
Frame* f1=new Frame;
f1->LoadFrame(IDR_MENU1);
m_pMainWnd=f1;
m_pMainWnd->ShowWindow(3);
m_pMainWnd->UpdateWindow();
return TRUE;
}
Win W1;
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script1.rc
//
#define IDR_MENU1 101
#define ID_MENUITEM40001 40001
#define ID_MENUITEM40002 40002
#define ID_MENUITEM40003 40003
#define ID_MENUITEM40004 40004
#define ID_MENUITEM40005 40005
#define ID_BUTTON40006 40006
#define ID_BUTTON40007 40007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40008
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
or any one tell me How to create a MDI window with a menu without using appwizard.
Thank you
By Balasubramaniam.J