什么是DrawMenuBar

核心提示DrawMenuBar是一个计算机函数,功能是该函数重画指定菜单的菜单条。外文名DrawMenuBar适用领域计算机,编程,API应用学科数学函数原型BOOL DrawMenuBar(HWND hWnd)如果系统创建窗口以后菜单条被修改,则

最佳答案:

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.

}

}

 
友情链接
鄂ICP备19019357号-22