|
-
March 28th, 1999, 12:02 PM
#1
Assertion Error While Creating MDI Window
I have tired to create mdi window in two ways but in both the case it is
displaying the same error and if i ignore it it is displaying the mdi window please any one of you solve it for me
and tell me what is the mistake that i have done so i could rectify it.
i am enclosing my code below.
prog 1
#include<afxwin.h>
#include<afxext.h>
#include "resource.h"
class Win ublic CWinApp
{
public:
BOOL InitInstance();
};
class Frame ublic CMDIFrameWnd
{
public:
Frame();
afx_msg int PreCreateWindow(CREATESTRUCT &cs);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(Frame,CMDIFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
Frame::Frame()
{
}
int Frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
int Frame::PreCreateWindow(CREATESTRUCT &cs)
{
return CMDIFrameWnd::PreCreateWindow(cs);
}
BOOL Win::InitInstance()
{
Frame* pMainFrame = new Frame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
m_pMainWnd->ShowWindow(3);
m_pMainWnd->UpdateWindow();
return TRUE;
}
Win w1;
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script2.rc
//
#define IDR_MENU1 101
#define IDR_MAINFRAME 101
#define ID_MENUITEM40001 40001
#define ID_MENUITEM40002 40002
#define ID_MENUITEM40003 40003
#define ID_MENUITEM40004 40004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40005
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
-
March 28th, 1999, 02:36 PM
#2
Need more details
What error are you getting? Where does the assert occur? What are you trying to do?
-
March 28th, 1999, 11:00 PM
#3
Re: Assertion Error While Creating MDI Window
I have tired to create mdi window in two ways but in both the case it is
displaying the same error and if i ignore it it is displaying the mdi window please any one of you solve it for me
and tell me what is the mistake that i have done so i could rectify it.
i am enclosing my code below.
prog 1
#include<afxwin.h>
#include<afxext.h>
#include "resource.h"
class Win ublic CWinApp
{
public:
BOOL InitInstance();
};
class Frame ublic CMDIFrameWnd
{
public:
Frame();
afx_msg int PreCreateWindow(CREATESTRUCT &cs);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(Frame,CMDIFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
Frame::Frame()
{
}
int Frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
int Frame::PreCreateWindow(CREATESTRUCT &cs)
{
return CMDIFrameWnd::PreCreateWindow(cs);
}
BOOL Win::InitInstance()
{
Frame* pMainFrame = new Frame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
m_pMainWnd->ShowWindow(3);
m_pMainWnd->UpdateWindow();
return TRUE;
}
Win w1;
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script2.rc
//
#define IDR_MENU1 101
#define IDR_MAINFRAME 101
#define ID_MENUITEM40001 40001
#define ID_MENUITEM40002 40002
#define ID_MENUITEM40003 40003
#define ID_MENUITEM40004 40004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40005
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
This was the message which i posted earlier and i am getting error message on
winmdi.cpp which is a system file on line number 139,141,151 and when i try to debug
it it is showing iMenu=-1 which should be grater than or equal to zero.
why it is showing error on menu.
The Object of the programme is to create a mdi window with menu.
Thank you
BalaSubramaniam.J
-
March 28th, 1999, 11:08 PM
#4
Re: Need more details
The Object of my programme is to create a mdi window with a menu but
it is displaying a assertion error on winmdi.cpp which is a system file on
line 139,141,151 and when i try to debug it is displaying error in menu=-1
which should be greater than or equal to zero.
please kindly solve my error
By Balasubramaniam.J
-
March 28th, 1999, 11:15 PM
#5
Re: Need more details
The Object of my programme is to create a mdi window with a menu but
it is displaying a assertion error on winmdi.cpp which is a system file on
line 139,141,151 and when i try to debug it is displaying error in iMenu=-1
which should be greater than or equal to zero.
ASSERT(iMenu >= 0);
pMenu = pMenu->GetSubMenu(iMenu);
ASSERT(pMenu != NULL)
in the above lines it is displaying error .
please kindly solve my error
-
March 29th, 1999, 11:44 AM
#6
Re: Assertion Error While Creating MDI Window
I think you should re-post your message with a subject line something like, "How to create a MDI window with a menu." I bet you'll get a lot of responses.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|