本文整理匯總了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;
}
示例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;
}
示例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;
}}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例9: WMDeleteMenu
void
WMDeleteMenu(short menuID)
{
if (!CheckRunningInMainThread("WMDeleteMenu"))
return;
DeleteMenu(menuID);
}
示例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");
}
示例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 );
}
示例12: LuaGuiDeleteMenu
static bool LuaGuiDeleteMenu(void *hMenu, uint32_t position, uint32_t flag)
{
return !! DeleteMenu(
reinterpret_cast<HMENU>(hMenu),
position,
flag);
}
示例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;
}
示例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);
}
}
示例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;
}