编译没有error,运行“内存不足”

ISABCJJ 2007-08-25 11:44:47
编译没有error,运行“内存不足”,调试运行到AddPage就提示“内存不足”。哥们,告诉我原因吧,怎么修改?
BOOL CEastRDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here
//加入标签,标签名由各个子对话框的标题栏决定
m_sheet.AddPage(&m_page1);//到这就“内存不足”
m_sheet.AddPage(&m_page2);

m_sheet.AddPage (&m_page1);

//用Create来创建一个属性页
m_sheet.Create(this, WS_CHILD | WS_VISIBLE, WS_EX_CONTROLPARENT);

RECT rect;
m_sheet.GetWindowRect(&rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;

//调整属性页的大小和位置
m_sheet.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);


m_List.InsertColumn (0,"机号",LVCFMT_CENTER,50);
m_List.InsertColumn (1,"波特率",LVCFMT_CENTER,60);
m_List.InsertColumn (2,"端口号",LVCFMT_CENTER,60);
m_List.InsertColumn (3,"机型",LVCFMT_CENTER,50);

DWORD dwStyle = GetWindowLong(m_List.GetSafeHwnd(),GWL_STYLE);
dwStyle &= ~LVS_TYPEMASK;
dwStyle |= LVS_REPORT;
SetWindowLong(m_List.GetSafeHwnd(),GWL_STYLE,dwStyle);
SetRedraw(TRUE);
Invalidate();
m_List.SetExtendedStyle(LVS_EX_CHECKBOXES);
m_List.SetCheck(0,true);


return TRUE; // return TRUE unless you set the focus to a control
}
...全文
316 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ISABCJJ 2007-08-26
  • 打赏
  • 举报
回复
电脑配置不低啊,512M内存阿。原因不在这!
wapit 2007-08-26
  • 打赏
  • 举报
回复
加内存? 增加页面文件大小?

说实话我没有仔细看你代码.

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧