Adding a menu dynamically

Hi All,

This is my pice of code for a window.

Menu.h

#include<afxwin.h>

class CmainWn : public CFrameWnd
{
public :CmainWn();
DECLARE_MESSAGE_MAP()
};


class CApp : public CWinApp
{
public : BOOL InitInstance();

};



Menu.cpp

#include"Menu.h"
#include"resource.h"
CmainWn ::CmainWn()
{
Create(NULL,"Menu Testing",WS_OVERLAPPEDWINDOW,rectDefault,NULL,(LPCTSTR)IDR_MENU1);
}

BOOL CApp :: InitInstance()
{
m_pMainWnd=new CmainWn();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;

}

BEGIN_MESSAGE_MAP(CmainWn,CFrameWnd)
END_MESSAGE_MAP()

CApp App;


I want to add some menus in it according to some condition.

how to do it.

Last edited on
Topic archived. No new replies allowed.