📄 menudata.cpp
字号:
// MenuData.cpp: implementation of the CMenuData class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "myie.h"
#include "MenuData.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#pragma optimize( "s", on)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMenuData::CMenuData()
{
m_nBitmap=-1;
m_szMenuText = NULL;
m_pImgList = NULL;
m_szURL = NULL;
m_bIni = TRUE;
}
CMenuData::~CMenuData()
{
if(m_szMenuText!=NULL)
delete[] m_szMenuText;
if(m_szURL!=NULL)
delete[] m_szURL;
}
BOOL SetMenuText(LPCSTR lpMenuText, CMenuData* md)
{
if(lpMenuText==NULL || md == NULL)
return FALSE;
int i = strlen(lpMenuText);
if(i>0)
{
if(md->m_szMenuText!=NULL)
delete[] md->m_szMenuText;
try
{
md->m_szMenuText = new char[i+1];
}
catch(CMemoryException* e)
{
md->m_szMenuText = NULL;
// if(e!=NULL)e->Delete();
return FALSE;
}
if(md->m_szMenuText == NULL)
return FALSE;
strcpy(md->m_szMenuText, lpMenuText);
return TRUE;
}
return FALSE;
}
BOOL SetURL(LPCSTR lpszURL, CMenuData* md)
{
if(lpszURL==NULL || md == NULL)
return FALSE;
int i = strlen(lpszURL);
if(i>0)
{
if(md->m_szURL!=NULL)
delete[] md->m_szURL;
try
{
md->m_szURL = new char[i+1];
}
catch(CMemoryException* e)
{
md->m_szURL = NULL;
// if(e!=NULL)e->Delete();
return FALSE;
}
strcpy(md->m_szURL, lpszURL);
return TRUE;
}
return FALSE;
}
#pragma optimize( "s", off)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -