当前位置: 首页>>代码示例>>C++>>正文


C++ DeleteMenu函数代码示例

本文整理汇总了C++中DeleteMenu函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteMenu函数的具体用法?C++ DeleteMenu怎么用?C++ DeleteMenu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DeleteMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdMenu

BOOL CALLBACK
UpdMenu(HWND  hwnd,LPARAM lParam)
{
    int i;
    BOOL flag=lParam;
    //    int Checked;
    HMENU hSysMenu=GetSystemMenu(hwnd, FALSE);
    for(i=0;i<GetMenuItemCount(hSysMenu) && hSysMenu;i++)
        if(GetMenuItemID(hSysMenu,i)==IDM_TRAY) hSysMenu = 0;
    if (hSysMenu && lParam)
    {
        InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_SEPARATOR,IDM_SEPARATOR, NULL) ;
        if(GetWindowLong(hwnd,GWL_EXSTYLE)&WS_EX_TOPMOST)
            InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING|MF_CHECKED,IDM_ONTOP,"Always on top");
        else
            InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_ONTOP,"Always on top");
        InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_TRAY,"Minimize in tray");
        InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_SIZE,"My size");
    }
    if (hSysMenu && lParam==FALSE)
    {
        DeleteMenu (hSysMenu,IDM_TRAY,MF_BYCOMMAND);
        DeleteMenu (hSysMenu,IDM_ONTOP,MF_BYCOMMAND);
        DeleteMenu (hSysMenu,IDM_SEPARATOR,MF_BYCOMMAND);
        DeleteMenu (hSysMenu,IDM_SIZE,MF_BYCOMMAND);

    }
    return TRUE;
}
开发者ID:shelt,项目名称:RBXTray,代码行数:29,代码来源:rbtray.c

示例2: Create

			//////////////////////////////////////
			// Create the window
			//////////////////////////////////////
HWND Create(HINSTANCE hInst, int nCmdShow)
{
 	RECT Rect;
	GetWindowRect(GetDesktopWindow(), &Rect);
	long ScreenW = Rect.right, ScreenH = Rect.bottom;

	global = (LPGLOBAL)malloc(sizeof(GLOBAL));

  global->MainVar.MainhInst = hInst;
  
  global->MainVar.MainHwnd = CreateWindow(MAINWINDOW, MAINWINDOW,
                           WS_BORDER | 
                           WS_SYSMENU | 
                           WS_CAPTION |
                           WS_MINIMIZEBOX | 
                           WS_MAXIMIZEBOX ,
                           0, 0, 
                           ScreenW, ScreenH,
                           NULL, NULL, hInst, NULL);

	DeleteMenu(GetSystemMenu(global->MainVar.MainHwnd, FALSE),  SC_MOVE, MF_BYCOMMAND);
	DeleteMenu(GetSystemMenu(global->MainVar.MainHwnd, FALSE),  SC_SIZE, MF_BYCOMMAND);

  if (global->MainVar.MainHwnd == NULL)
     return global->MainVar.MainHwnd;
  
  ShowWindow(global->MainVar.MainHwnd, nCmdShow);
  UpdateWindow(global->MainVar.MainHwnd);
  return global->MainVar.MainHwnd;
}
开发者ID:jstty,项目名称:OlderProjects,代码行数:33,代码来源:MainWindow.cpp

示例3: mh_deleteitem

static int mh_deleteitem (lua_State* l) {
menu* m = lua_touserdata(l,1);
if (lua_isnoneornil(l,2)) {
const char* menuName = GetMenuName(m->parent, m->position);
if (menuName) free(menuName);
DeleteMenu(m->parent, m->command, MF_BYCOMMAND);
if (!m->sub) {
removeCustomCommand(m->command);
removeAccelerator(m->command);
} 
DrawMenuBar(win);
return 0;
}
else {
if (!m->sub) return 0;
menu* x = lua_touserdata(l,2);
const char* menuName = GetMenuName(m->menu, x->position);
if (menuName) free(menuName);
DeleteMenu(m->menu, x->command, MF_BYCOMMAND);
DrawMenuBar(win);
if (!x->sub) {
removeCustomCommand(x->command);
removeAccelerator(x->command);
}
lua_settop(l,1);
return 1;
}}
开发者ID:qtnc,项目名称:6pad,代码行数:27,代码来源:luamenuhandle.c

示例4: update_item_menu

void update_item_menu(short mode)
//mode 0 - display item menus 1 - lock menus
{
	short i,j;

	HMENU menu[10],big_menu;
	char item_name[256];

	big_menu = GetMenu(mainPtr);

	for (i = 0; i < 10; i++)
		menu[i] = GetSubMenu(big_menu,3 + i);
	for(j=0;j<10;j++){  //first let's clean the menu
       DeleteMenu(menu[j],1000 + j,MF_BYCOMMAND); //If there is any dummy, flush it
	   for (i=0;i<40;i++)
       		DeleteMenu(menu[j],600+(40*j)+i,MF_BYCOMMAND);
    }
    switch(mode){
    case 0:
	for (j = 0; j < 10; j++) { //then populate it
		for (i = 0; i < 40; i++) {
				sprintf(item_name, "%s",scen_item_list.scen_items[i + j * 40].full_name);
				if ((i % 20 == 0) && (i > 0))
					AppendMenu(menu[j],MF_MENUBREAK | MF_BYCOMMAND | MF_ENABLED | MF_STRING, 600 + (40 * j) + i, item_name);
					else AppendMenu(menu[j],MF_BYCOMMAND | MF_ENABLED | MF_STRING, 600 + (40 * j) + i, item_name);
				}
		}
    break;

    case 1:
    for (j = 0; j < 10; j++) //then lock menus
	       AppendMenu(menu[j],MF_MENUBREAK | MF_BYCOMMAND | MF_GRAYED | MF_STRING, 600 + (40 * j), "None");
    break;
    }
}
开发者ID:Ircher,项目名称:CBoE,代码行数:35,代码来源:bladpced.cpp

示例5: FreeLogList

VOID
FreeLogList(void)
{
    DWORD dwIndex;

    if (!LogNames)
    {
        return;
    }

    for (dwIndex = 0; dwIndex < dwNumLogs; dwIndex++)
    {
        if (LogNames[dwIndex])
        {
            HeapFree(GetProcessHeap(), 0, LogNames[dwIndex]);
        }

        DeleteMenu(hMainMenu, ID_FIRST_LOG + dwIndex, MF_BYCOMMAND);
    }

    DeleteMenu(hMainMenu, ID_FIRST_LOG + dwIndex + 1, MF_BYCOMMAND);

    HeapFree(GetProcessHeap(), 0, LogNames);

    dwNumLogs = 0;

    return;
}
开发者ID:Strongc,项目名称:reactos,代码行数:28,代码来源:eventvwr.c

示例6: GetRecentFiles

/*****************************Private*Routine******************************\
* GetRecentFiles
*
* Reads at most MAX_RECENT_FILES from the app's registry entry. 
* Returns the number of files actually read.  
* Updates the File menu to show the "recent" files.
*
\**************************************************************************/
int
GetRecentFiles(
    int iLastCount,
    int iMenuPosition   // Menu position of start of MRU list
    )
{
    int     i;
    TCHAR   FileName[MAX_PATH];
    TCHAR   szKey[32];
    HMENU   hSubMenu;

    //
    // Delete the files from the menu
    //
    hSubMenu = GetSubMenu(GetMenu(hwndApp), 0);

    // Delete the separator at the requested position and all the other 
    // recent file entries
    if(iLastCount != 0)
    {
        DeleteMenu(hSubMenu, iMenuPosition, MF_BYPOSITION);

        for(i = 1; i <= iLastCount; i++)
        {
            DeleteMenu(hSubMenu, ID_RECENT_FILE_BASE + i, MF_BYCOMMAND);
        }
    }

    for(i = 1; i <= MAX_RECENT_FILES; i++)
    {
        DWORD   len;
        TCHAR   szMenuName[MAX_PATH + 3];

        (void)StringCchPrintf(szKey, NUMELMS(szKey), TEXT("File %d\0"), i);

        len = ProfileStringIn(szKey, TEXT(""), FileName, MAX_PATH * sizeof(TCHAR));
        if(len == 0)
        {
            i = i - 1;
            break;
        }

        StringCchCopy(aRecentFiles[i - 1], NUMELMS(aRecentFiles[i-1]), FileName);
        (void)StringCchPrintf(szMenuName, NUMELMS(szMenuName), TEXT("&%d %s\0"), i, FileName);

        if(i == 1)
        {
            InsertMenu(hSubMenu, iMenuPosition, MF_SEPARATOR | MF_BYPOSITION, (UINT)-1, NULL);
        }

        InsertMenu(hSubMenu, iMenuPosition + i, MF_STRING | MF_BYPOSITION,
            ID_RECENT_FILE_BASE + i, szMenuName);
    }

    //
    // i is the number of recent files in the array.
    //
    return i;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:67,代码来源:persist.cpp

示例7: DestroyMenu

void CAppWindow::ShowContextMenu()
{
	if (!AllowContextMenu())
	{
		return;
	}

	if (CPopupWindow::Instance() != NULL)
	{
		CPopupWindow::Instance()->CancelAll();
	}

	if (m_hPopupMenus != NULL)
	{
		DestroyMenu(m_hPopupMenus);
	}

	m_hPopupMenus = LoadMenu(CApp::Instance()->GetInstance(), MAKEINTRESOURCE(IDR_POPUP_MENUS));

	HMENU hSubMenu = GetSubMenu(m_hPopupMenus, 0);

	if (m_lpSession->GetState() == WSS_ONLINE || m_lpSession->GetState() == WSS_RECONNECTING)
	{
		DeleteMenu(hSubMenu, ID_TRAYICON_LOGIN, MF_BYCOMMAND);
	}
	else
	{
		DeleteMenu(hSubMenu, ID_TRAYICON_SIGNOUT, MF_BYCOMMAND);

		EnableMenuItem(hSubMenu, ID_TRAYICON_INBOX, MF_GRAYED | MF_BYCOMMAND);

		EnableMenuItem(hSubMenu, ID_TRAYICON_CHECKWAVESNOW, MF_GRAYED | MF_BYCOMMAND);
	}

	if (CVersion::Instance()->GetState() != VS_NONE)
	{
		EnableMenuItem(hSubMenu, ID_TRAYICON_CHECKFORUPDATESNOW, MF_GRAYED | MF_BYCOMMAND);
	}

	POINT p;

	GetCursorPos(&p);

	SetForegroundWindow(GetHandle());

	TrackPopupMenuEx(
		hSubMenu,
		TPM_VERTICAL | TPM_RIGHTALIGN,
		p.x,
		p.y,
		GetHandle(),
		NULL);

	PostMessage(WM_NULL);
}
开发者ID:pvginkel,项目名称:wave-notify,代码行数:55,代码来源:CAppWindow.cpp

示例8: DeleteMenu

//---------------------------------------------------------------------
// InitializePopup():
//---------------------------------------------------------------------
void WPDIRECTORY::InitializePopup(HMENU hmenuPopup)
{
   // Call base class function.
   WPFOLDER::InitializePopup(hmenuPopup);

   // Delete menu item "Create another..." in folder popup menu.
   DeleteMenu(hmenuPopup,IDM_CREATEANOTHER,MF_BYCOMMAND);
   // Delete menu item "Create shadow..." in folder popup menu.
   DeleteMenu(hmenuPopup,IDM_CREATESHADOW,MF_BYCOMMAND);
   // Delete menu item "Delete..." in folder popup menu.
   DeleteMenu(hmenuPopup,IDM_FIND,MF_BYCOMMAND);
}
开发者ID:OS2World,项目名称:WIN16-Worplace-Shell-for-Windows,代码行数:15,代码来源:WPDRIVE.CPP

示例9: WMDeleteMenu

void
WMDeleteMenu(short menuID)
{
	if (!CheckRunningInMainThread("WMDeleteMenu"))
		return;
	DeleteMenu(menuID);
}
开发者ID:prheenan,项目名称:IgorUtil,代码行数:7,代码来源:XOPMenus.c

示例10: BiasMenu

VOID NEAR PASCAL BiasMenu(HMENU hMenu, INT Bias)
{
        INT pos, id, count;
        HMENU hSubMenu;
        CHAR szMenuString[80];

        ENTER("BiasMenu");

        count = GetMenuItemCount(hMenu);

        if (count < 0)
                return;

        for (pos = 0; pos < count; pos++) {

                id = GetMenuItemID(hMenu, pos);

                if (id < 0) {
                        // must be a popup, recurse and update all ID's here
                        if (hSubMenu = GetSubMenu(hMenu, pos))
                                BiasMenu(hSubMenu, Bias);
                } else if (id) {
                        // replace the item that was there with a new
                        // one with the id adjusted

                        GetMenuString(hMenu, (WORD)pos, szMenuString, sizeof(szMenuString), MF_BYPOSITION);
                        DeleteMenu(hMenu, pos, MF_BYPOSITION);
                        InsertMenu(hMenu, (WORD)pos, MF_BYPOSITION | MF_STRING, id + Bias, szMenuString);
                }
        }
        LEAVE("BiasMenu");
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:32,代码来源:wfinit.c

示例11: DeleteBlinkManagerEntry

/* Delete the specified blink manager entry.
 */
void FASTCALL DeleteBlinkManagerEntry( LPBLINKENTRY lpbe )
{
   /* First unlink this entry from
    * the list.
    */
   if( lpbe->lpbePrev )
      lpbe->lpbePrev->lpbeNext = lpbe->lpbeNext;
   else
      lpbeFirst = lpbe->lpbeNext;
   if( lpbe->lpbeNext )
      lpbe->lpbeNext->lpbePrev = lpbe->lpbePrev;

   /* Delete the associated command from the
    * command table. This will also remove any
    * toolbar button.
    */
   CTree_DeleteCommand( lpbe->iCommandID );

   /* Delete from the Blink menu.
    */
   DeleteMenu( hBlinkMenu, lpbe->iCommandID, MF_BYCOMMAND );

   /* Delete from the registry.
    */
   Amuser_WritePPString( szBlinkman, lpbe->szName, NULL );

   /* Free the allocated memory.
    */
   FreeMemory( &lpbe );
}
开发者ID:cixonline,项目名称:ameol,代码行数:32,代码来源:blinkman.c

示例12: LuaGuiDeleteMenu

	static bool LuaGuiDeleteMenu(void *hMenu, uint32_t position, uint32_t flag)
	{
		return !! DeleteMenu(
			reinterpret_cast<HMENU>(hMenu),
			position,
			flag);
	}
开发者ID:myeang1,项目名称:YDWE,代码行数:7,代码来源:luaopen_gui.cpp

示例13: DeleteMenu

//
/// Merges the functional groups of another menu descriptor into this menu
/// descriptor.
///
/// Popups are DeepCopied and are then owned by this menu
/// Group counts are merged too.
//
bool
TMenuDescr::Merge(const TMenuDescr& srcMenuDescr)
{
  int thisOffset = 0;
  int srcOffset = 0;

  for (int i = 0; i < NumGroups; i++) {
    if (srcMenuDescr.GroupCount[i] != 0) {
      // Delete same menu group in the dest. menudescr.
      for (int j = GroupCount[i] - 1; j >= 0; j--) {
        DeleteMenu(thisOffset+j, MF_BYPOSITION);
      }
      GroupCount[i] = 0;

      if (srcMenuDescr.GroupCount[i] > 0) {
        DeepCopy(*this, thisOffset, srcMenuDescr, srcOffset, srcMenuDescr.GroupCount[i]);
        srcOffset += srcMenuDescr.GroupCount[i];
        GroupCount[i] += srcMenuDescr.GroupCount[i];
      }
    }

    if (GroupCount[i] > 0)
      thisOffset += GroupCount[i];
  }
  return true;
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:33,代码来源:menudesc.cpp

示例14: DeleteSubMenus

static void DeleteSubMenus(SubSysMenuHandle subSysMenus)
	// Remove any sub-menus that we added to the menu bar.
	// Basically this just walks subSysMenus (backwards, which
	// isn't strictly necessary, but reassures me that the menu
	// bar is somewhat consistent at each step), deleting each
	// menu from the menu bar and reseting its parent to reference
	// menu ID 0.
{
	ItemCount entryCount;
	ItemCount entryIndex;
	SubSysMenuEntry thisEntry;
	
	// Have to handle both NULL and non-NULL case.
	// This expression always evaluates to true,
	// but it captures the semantics of what this
	// routine must do.
	
	assert(subSysMenus != NULL || subSysMenus == NULL);
	
	entryCount = CountSubSysMenus(subSysMenus);
	for (entryIndex = 0; entryIndex < entryCount; entryIndex++) {
		thisEntry = (*subSysMenus)[entryCount - entryIndex - 1];
		DeleteMenu( (**(thisEntry.childMenu)).menuID );
		SetItemMark( thisEntry.parentMenu, thisEntry.itemInParent, 0);

		// Recalculate the parent menu size, for consistency with
		// the similar code in InsertSystemSubMenu.
		
		CalcMenuSize(thisEntry.parentMenu);
	}
}
开发者ID:fruitsamples,项目名称:MoreIsBetter,代码行数:31,代码来源:MoreSystemMenus.c

示例15: GetSystemMenu

LRESULT CDuilib3dFrame::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	styleValue &= ~WS_THICKFRAME;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

	HMENU hMenu = GetSystemMenu(m_hWnd,FALSE);
	if (hMenu != NULL)
	{
		DeleteMenu(hMenu,SC_MAXIMIZE,MF_BYCOMMAND);
	}

	//根据skin.xml创建程序界面
	m_PaintManager.Init(m_hWnd);

	CDialogBuilder builder;
	CDialogBuilderCallbackEx cb;
	CControlUI* pRoot = builder.Create(_T("skin.xml"), (UINT)0,  &cb, &m_PaintManager);
	ASSERT(pRoot && "Failed to parse XML");

	m_PaintManager.AttachDialog(pRoot);
	m_PaintManager.AddNotifier(this);

	HICON hIcon = LoadIcon((HINSTANCE)GetWindowLong(m_hWnd,GWL_HINSTANCE),MAKEINTRESOURCE(IDI_ICON));
	m_tray.Create(m_hWnd,WM_USER+1021,_T("360安全卫士"),hIcon,NULL);

	return 0;
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:29,代码来源:Duilib3dFrame.cpp


注:本文中的DeleteMenu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。