分享好友 天南地北首页 网站导航

什么是DrawMenuBar

网友 2023-09-16 13:48 · 头闻号教育培训

最佳答案:

DrawMenuBar是一个计算机函数,功能是该函数重画指定菜单的菜单条。

详情介绍

DrawMenuBar是一个计算机函数,功能是该函数重画指定菜单的菜单条。

外文名
DrawMenuBar
适用领域
计算机,编程,API
应用学科
数学
函数原型
BOOL DrawMenuBar(HWND hWnd)

如果系统创建窗口以后菜单条被修改,则必须调用此函数来画修改了的菜单条。

函数原型:BOOL DrawMenuBar(HWND hWnd);

参数:

hWnd:其菜单条需要被重画的窗口的句柄。

返回值:如果函数调用成功,返回非零值:如果函数调用失败,返回值是零。若想获得更多的错误信息,请调用GetLastError函数。

速查:Windows NT:及以上版本;Windows:95及以上版本;Windows:2.0及以上版本;头文件:winuser.h;输入库:user32.lib。

示例:

void CMainframe::OnCwndDeletefilemenu()

{

// This example deletes the leftmost popup menu or leftmost

// popup menu item from the application's main window.

CWnd* pMain = AfxGetMainWnd();

// The main window _can_ be NULL, so this code

// doesn't ASSERT and actually tests.

if (pMain != NULL)

{

// Get the main window's menu

CMenu* pMenu = pMain->GetMenu();

// If there is a menu and it has items, we'll

// delete the first one.

if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)

{

pMenu->DeleteMenu(0, MF_BYPOSITION);

// force a redraw of the menu bar

pMain->DrawMenuBar();

}

// No need to delete pMenu because it is an MFC

// temporary object.

}

}

免责声明:本平台仅供信息发布交流之途,请谨慎判断信息真伪。如遇虚假诈骗信息,请立即举报

举报
反对 0
打赏 0
更多相关文章

收藏

点赞