CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    8

    CMDIFrameWnd::OnCreate(lpCreateStruct) causing trouble while creating mdi with menu



    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 Winublic CWinApp

    {

    public:

    BOOL InitInstance();

    };

    class Frameublic 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



  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: CMDIFrameWnd::OnCreate(lpCreateStruct) causing trouble while creating mdi with menu

    Do you still need as answer?

    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured