コード例 #1
0
ファイル: TabCtrl.cpp プロジェクト: Tallefer/bombusng-md
void TabsCtrl::processPopupMenu( bool cmdBar, int posX, int posY ) {

    HMENU hmenu = getContextMenu();
    menuUserCmds(hmenu);

    if (hmenu==NULL) return;

    if (!cmdBar && activeTab>0) {
        BOOL result=InsertMenu(hmenu, 0, MF_STRING | MF_BYPOSITION, TabsCtrl::CLOSETAB, TEXT("Close"));
        result=InsertMenu(hmenu, 1, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
    }

    HWND hWnd=getHWnd();

    POINT pt={posX, posY };
    if (!cmdBar) ClientToScreen(hWnd, &pt);
    int cmd=TrackPopupMenuEx(hmenu,
        (cmdBar)? (TPM_BOTTOMALIGN | TPM_RETURNCMD) : (TPM_TOPALIGN | TPM_RETURNCMD),
        pt.x, pt.y,
        hWnd,
        NULL);

    if (cmd!=0) {
        MENUITEMINFO mi;
        mi.cbSize=sizeof(mi);
        mi.fMask=MIIM_DATA;
        GetMenuItemInfo(hmenu, cmd, FALSE, &mi);

        if (cmd>=TabsCtrl::SWITCH_TAB && cmd<TabsCtrl::USERCMD) {
            ODR *wt=(ODR*)((void *) mi.dwItemData);
            //switch to the selected tab
            switchByODR(wt);
        }

        if (cmd>=TabsCtrl::USERCMD) {
            menuUserActions(cmd, mi.dwItemData);
        }

        if (cmd==TabsCtrl::CLOSETAB) {
            PostMessage(hWnd, WM_COMMAND, cmd, mi.dwItemData);
        }
    }
    DestroyMenu(hmenu);
}
コード例 #2
0
/// shell view callback
HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (uMsg == SFVM_INITMENUPOPUP) {
        ///@todo never reached
        InsertMenu((HMENU)lParam, 0, MF_BYPOSITION, 12345, TEXT("TEST ENTRY"));
        return S_OK;
    }

    return E_NOTIMPL;
}
コード例 #3
0
ファイル: trayicon.c プロジェクト: BackupTheBerlios/quitter
void
show_popup_menu ()
{
    POINT pt;
    GetCursorPos (&pt);

    menu = CreatePopupMenu();
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_PROPERTIES, "&Properties");
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_ABOUT, "&About");
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_CLOSE, "&Close");

    SetForegroundWindow (msg_window);
    TrackPopupMenu (menu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_BOTTOMALIGN,
                    pt.x, pt.y, 0, msg_window, NULL);
    SendMessage (msg_window, WM_NULL, 0, 0);
}
コード例 #4
0
ファイル: menu.c プロジェクト: 1212freshman/Git-Cheetah
/*
 * menu_item_builder to build a Windows-specific menu separator
 *
 * Always returns FALSE so the menu engine does not track this item
 */
BOOL build_separator(struct git_data *data, const struct menu_item *item,
		     void *platform)
{
	struct windows_menu_data *windows_menu = platform;
	InsertMenu(windows_menu->menu, windows_menu->index,
		MF_SEPARATOR | MF_BYPOSITION, 0, "");
	windows_menu->index++;

	return FALSE;
}
コード例 #5
0
ファイル: glutes_menu.c プロジェクト: damiannz/glutes
void FGAPIENTRY glutChangeToMenuEntry(int num, const char *label, int value)
{
	SFG_WinMenuItem *item;
	int i;
#ifdef UNICODE
	WCHAR *wlabel;
#endif
	if (fgMappedMenu)
		menuModificationError();
	
	i = fgCurrentMenu->Num;
	item = fgCurrentMenu->List;
	while (item) 
	{
		if (i == num) 
		{
			if (item->IsTrigger) 
			{
			/* If changing a submenu trigger to a menu entry, we
				need to account for submenus.  */
				item->Menu->SubMenus--;
			}
			
			free(item->Label);
			item->Label = _strdup(label);
			if (!item->Label) 
				fgError("out of memory");
			item->IsTrigger = FALSE;
			item->Len = (int) strlen(label);
			item->Value = value;
			item->Unique = UniqueMenuHandler++;
			
#ifdef UNICODE
			wlabel = (WCHAR*)malloc((item->Len + 1) * sizeof(WCHAR));
			mbstowcs(wlabel, label, item->Len + 1);
#endif
			RemoveMenu(fgCurrentMenu->Handle, (UINT) i - 1, MF_BYPOSITION);
			InsertMenu(fgCurrentMenu->Handle, (UINT) i - 1, MF_BYPOSITION | MFT_STRING, item->Unique, 
#ifdef UNICODE
				wlabel
#else
				label
#endif
				);
#ifdef UNICODE
			free(wlabel);
#endif
			
			return;
		}
		i--;
		item = item->Next;
	}
	fgWarning("Current menu has no %d item.", num);
}
コード例 #6
0
ファイル: CRSVMAC.C プロジェクト: marcinch18/nasa-cosmic
SetUpMenus()
  {
   /*================================================*/
   /* Get the Apple menu from the resource file, add */
   /* the names of available desk accessories, and   */
   /* install it at the end of the menu bar.         */
   /*================================================*/
   
   AppleMenu = GetMenu(AppleID);
   AddResMenu(AppleMenu,'DRVR');
   InsertMenu(AppleMenu,0);
   
   /*==============================================*/
   /* Get the File menu from the resource file and */
   /* install it at the end of the menu bar.       */
   /*==============================================*/
   
   FileMenu = GetMenu(FileID);
   InsertMenu(FileMenu,0);
   
   /*==============================================*/
   /* Get the Edit menu from the resource file and */
   /* install it at the end of the menu bar.       */
   /*==============================================*/
   
   EditMenu = GetMenu(EditID);
   InsertMenu(EditMenu,0);
   
   /*=============================================*/
   /* Get the Options menu from the resource file */
   /* and install it at the end of the menu bar.  */
   /*=============================================*/
   
   OptionsMenu = GetMenu(OptionsID);
   InsertMenu(OptionsMenu,0);
   
   /*======================================*/
   /* Show the new menu bar on the screen. */
   /*======================================*/
   
   DrawMenuBar();
  }  
コード例 #7
0
ファイル: LaunchBrowser.cpp プロジェクト: MOURAD24/SearchClip
void ShowContextMenu(HWND hWnd)
{
	MENUITEMINFO separatorBtn = {0};
	separatorBtn.cbSize = sizeof(MENUITEMINFO);
	separatorBtn.fMask = MIIM_FTYPE;
	separatorBtn.fType = MFT_SEPARATOR;
	HMENU hMenu = CreatePopupMenu();
	if(hMenu != NULL)
	{
		InsertMenu(hMenu, -1, MF_BYPOSITION, ID_FILE_OPTIONS, GString(IDS_MENU_OPTIONS).c_str());
		InsertMenuItem(hMenu, -1, FALSE, &separatorBtn);
		InsertMenu(hMenu, -1, MF_BYPOSITION, IDM_EXIT, GString(IDS_MENU_EXIT).c_str());
		POINT pt;
		GetCursorPos(&pt);
		SetForegroundWindow(hWnd);
		TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWnd, NULL);
		DestroyMenu(hMenu);
		PostMessage(hWnd, WM_NULL, 0, 0);
	}
}
コード例 #8
0
HRESULT CContextMenuExt::QueryContextMenu ( HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags )
{
	// If the flags include CMF_DEFAULTONLY then we shouldn't do anything.
	if ( uFlags & CMF_DEFAULTONLY )
		return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 );

	InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION,
		uidFirstCmd, _T("Syncany Context Menu") );

	return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
}
コード例 #9
0
//add by ray 2014-05-15 17:48
HRESULT CSimpleShlExt::QueryContextMenu ( HMENU hmenu,UINT uMenuIndex, UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags )
{          
	// 如果标志包含 CMF_DEFAULTONLY 我们不作任何事情. 
	if ( uFlags & CMF_DEFAULTONLY ) 
	{ 
		return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 ); 
	} 

	InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("SimpleShlExt Test Item") ); 
	return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
}
コード例 #10
0
ファイル: ugView.c プロジェクト: rolk/ug
static void SetUpMenus ()
{
  int i;

  for (i=0; i<menuCount; i++)
    myMenus[i] = GetMenu(i+appleID);
  AppendResMenu(myMenus[0],'DRVR');
  for (i=0; i<menuCount; i++)
    InsertMenu(myMenus[i],0);                                           /* Add menus to menu bar */
  DrawMenuBar();
}
コード例 #11
0
void VirtualDimension::UnShrink(void)
{
	RECT pos;
	DWORD style;

	if (!m_shrinked)
	return;

	//Change the method to use for painting the window
	SetMessageHandler(WM_PAINT, deskMan, &DesktopManager::OnPaint);

	//Restore the window's style
	style = GetWindowLong(m_hWnd, GWL_STYLE);
	style |= (m_hasCaption ? WS_CAPTION : WS_DLGFRAME);
	style |= (m_lockPreviewWindow ? 0 : WS_THICKFRAME);
	SetWindowLongPtr(m_hWnd, GWL_STYLE, style);

	if (!m_lockPreviewWindow)
	{
		InsertMenu(m_pSysMenu, 0, MF_BYPOSITION, SC_SIZE, TEXT("&Size"));
		InsertMenu(m_pSysMenu, 0, MF_BYPOSITION, SC_MOVE, TEXT("&Move"));
	}

	//Restore the windows position
	pos.left = m_location.x;
	pos.right = pos.left + deskMan->GetWindowWidth();
	pos.top = m_location.y;
	pos.bottom = pos.top + deskMan->GetWindowHeight();
	AdjustWindowRectEx(&pos, GetWindowLong(m_hWnd, GWL_STYLE), FALSE, GetWindowLong(m_hWnd, GWL_EXSTYLE));

	//Apply the changes
	SetWindowPos(m_hWnd, NULL, pos.left, pos.top, pos.right-pos.left, pos.bottom-pos.top, SWP_DRAWFRAME | SWP_NOZORDER | SWP_FRAMECHANGED);

	//Enable tooltips
	tooltip->ShowTooltips(true);

	//Refresh the display
	Refresh();

	m_shrinked = false;
}
コード例 #12
0
void InitEditMenu( HWND wnd, int bitmap )
/***************************************/
{
    HMENU       submenu;
    int         nummenus;
    char        menuname[MAX_MENU + 1];
    int         i;
    bool        editfound;
    int         len;
    HMENU       mainmenu;

    if( bitmap != MENU_NONE ) {
        mainmenu = GetMenu( wnd );
        if( mainmenu == NULL ) {
            return;
        }
        nummenus = GetMenuItemCount( mainmenu );
        if( bitmap & EDIT_MENU_FLAGS ) {
            editfound = false;
            for( i = 0; i < nummenus; ++i ) {
                len = GetMenuString( mainmenu, i, menuname, MAX_MENU, MF_BYPOSITION );
                FixMenuName( menuname, len );
                if( !editfound && stricmp( menuname, "EDIT" ) == 0 ) {
                    editfound = true;
                    AddFMEditMenus( GetSubMenu( mainmenu, i ), bitmap );
                }
            }
            if( !editfound ) {
                submenu = CreatePopupMenu();
                AddFMEditMenus( submenu, bitmap );
                InsertMenu( mainmenu, nummenus - 1, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, "&Edit" );
                ++nummenus;
            }
        }
        if( bitmap & MENU_SETUP ) {
            submenu = LoadMenu( GetInst(), "SetupMenu" );
            InsertMenu( mainmenu, nummenus - 1, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, "&Setup" );
            DrawMenuBar( GetAppWnd() );
        }
    }
}
コード例 #13
0
HRESULT CContextMenuHandler::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
	if (!(uFlags & CMF_DEFAULTONLY))
	{
		CString strResizeItem;
		strResizeItem.LoadString(IDS_RESIZEITEM);
		
		InsertMenu(hmenu, indexMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_PHOTORESIZE, strResizeItem);
	}

	return MAKE_HRESULT(SEVERITY_SUCCESS, 0, IDM_PHOTORESIZE + 1);
}
コード例 #14
0
ファイル: openfile.cpp プロジェクト: DmitrySigaev/gpac_hbbtv
static void switch_menu_pl()
{
	DeleteMenu(g_hMenuView, IDM_OF_VIEW_ALL, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_UP, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_DOWN, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_CLEAR, MF_BYCOMMAND);
	
	if (playlist_mode) {
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_CLEAR, _T("Clear"));
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_DOWN, _T("Move Down") );
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_UP, _T("Move Up") );
	} else {
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_VIEW_ALL, _T("All Unknown Files") );
	}
	TBBUTTONINFO tbbi; 
	tbbi.cbSize = sizeof(tbbi); 
	tbbi.dwMask = TBIF_TEXT; 
	tbbi.pszText = playlist_mode ? _T("Remove") : _T("Add"); 
	SendMessage(g_hWndMenuBar, TB_SETBUTTONINFO, IDM_OF_PL_ACT, (LPARAM)&tbbi); 
	refresh_menu_states();
}
コード例 #15
0
STDMETHODIMP CFdmUplShlExt::QueryContextMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd, UINT idCmdLast, UINT uFlags)
{
	if (uFlags & CMF_DEFAULTONLY)
		return MAKE_HRESULT (SEVERITY_SUCCESS, FACILITY_NULL, 0);

	char sz [1000] = "";

	CRegKey key;
	if (ERROR_SUCCESS == key.Open (HKEY_CURRENT_USER, 
			"Software\\FreeDownloadManager.ORG\\Free Upload Manager\\Settings\\Integration", KEY_READ))
	{
		DWORD dw = sizeof (sz);
		key.QueryValue (sz, "UploadString", &dw);
	}

	InsertMenu (hmenu, uMenuIndex++, MF_BYPOSITION, MF_SEPARATOR, 0);
	InsertMenu (hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, *sz ? sz : "Upload");
	
	
	return MAKE_HRESULT (SEVERITY_SUCCESS, FACILITY_NULL, 2);
}
コード例 #16
0
ファイル: OCContextMenu.cpp プロジェクト: 24killen/client
IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
	HRESULT hr;

	if (!(CMF_DEFAULTONLY & uFlags))
	{
		InsertMenu(hMenu, indexMenu, MF_STRING | MF_BYPOSITION,	idCmdFirst + IDM_SHARE,	L"&Share with ownCloud");
	}
	hr = StringCbCopyW(m_pwszVerb, sizeof(m_pwszVerb), L"ownCloudShare");

	return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(IDM_SHARE + 1));
}
コード例 #17
0
int stop_thread_menu(int create)
{
	if(create){
		DeleteMenu(ghmenu,IDM_STOP_THREAD,MF_BYCOMMAND);
		InsertMenu(ghmenu,IDM_STOP_THREAD,MF_BYCOMMAND|MF_STRING,IDM_STOP_THREAD,"Cancel thread");
	}
	else{
		DeleteMenu(ghmenu,IDM_STOP_THREAD,MF_BYCOMMAND);
	}
	DrawMenuBar(ghmainframe);
	return 0;
}
コード例 #18
0
ファイル: GEApp.cpp プロジェクト: revelator/Revelator-Doom3
/*
================
rvGEApp::UpdateRecentFiles

Updates the mru in the menu
================
*/
void rvGEApp::UpdateRecentFiles ( void )
{
    int i;
    int j;

    // Make sure everything is initialized
    if ( !mRecentFileMenu )
    {
        InitRecentFiles ( );
    }

    // Delete all the old recent files from the menu's
    for ( i = 0; i < rvGEOptions::MAX_MRU_SIZE; i ++ )
    {
        DeleteMenu ( mRecentFileMenu, ID_GUIED_FILE_MRU1 + i, MF_BYCOMMAND );
    }

    // Make sure there is a separator after the recent files
    if ( mOptions.GetRecentFileCount() )
    {
        MENUITEMINFO info;
        ZeroMemory ( &info, sizeof(info) );
        info.cbSize = sizeof(info);
        info.fMask = MIIM_FTYPE;
        GetMenuItemInfo ( mRecentFileMenu, mRecentFileInsertPos+1,TRUE, &info );
        if ( !(info.fType & MFT_SEPARATOR ) )
        {
            InsertMenu ( mRecentFileMenu, mRecentFileInsertPos, MF_BYPOSITION|MF_SEPARATOR|MF_ENABLED, 0, NULL );
        }
    }

    // Add the recent files to the menu now
    for ( j = 0, i = mOptions.GetRecentFileCount ( ) - 1; i >= 0; i --, j++ )
    {
        UINT id = ID_GUIED_FILE_MRU1 + j;
        idStr str = va("&%d ", j+1);
        str.Append ( mOptions.GetRecentFile ( i ) );
        InsertMenu ( mRecentFileMenu, mRecentFileInsertPos+j+1, MF_BYPOSITION|MF_STRING|MF_ENABLED, id, str );
    }
}
コード例 #19
0
static void AddAboutToSystemMenu(HWND hDlg)
{
    MENUITEMINFO mii;
    HMENU hSysMenu;
    TCHAR szItemText[256];
    int nSeparatorIndex = -1;
    int nMenuCount;

    // Retrieve system menu
    hSysMenu = GetSystemMenu(hDlg, FALSE);
    if(hSysMenu != NULL)
    {
        // Find the separator
        nMenuCount = GetMenuItemCount(hSysMenu);
        for(int i = 0; i < nMenuCount; i++)
        {
            // Retrieve the item type
            ZeroMemory(&mii, sizeof(MENUITEMINFO));
            mii.cbSize = sizeof(MENUITEMINFO);
            mii.fMask = MIIM_FTYPE;
            GetMenuItemInfo(hSysMenu, i, TRUE, &mii);

            // Separator?
            if(mii.fType == MFT_SEPARATOR)
            {
                nSeparatorIndex = i;
                break;
            }
        }

        // If we found a separator, we need to add two more items
        if(nSeparatorIndex != -1)
        {
            LoadString(g_hInst, IDS_HELP_ABOUT, szItemText, _maxchars(szItemText));
            InsertMenu(hSysMenu, nSeparatorIndex, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
            InsertMenu(hSysMenu, nSeparatorIndex+1, MF_BYPOSITION | MF_STRING, SC_HELP_ABOUT, szItemText);
        }
    }
}
コード例 #20
0
ファイル: songlist.cpp プロジェクト: adamlamers/iPod_Recovery
CSongList::CSongList(HWND Parent) : tracks(NULL), OnAddItem(NULL)
{
    for(unsigned int i = 0; i < (sizeof(colSortDirs) / sizeof(bool)); i++)
    {
        colSortDirs[i] = false; /* Initialize them to false */
    }
    parent = Parent;
    handle = GetDlgItem(parent, IDC_SONGLIST);
    SendMessage(handle, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
    ListViewAddColumn(handle, 0, "", 23);
    ListViewAddColumn(handle, 1, "Name", 234);
    ListViewAddColumn(handle, 2, "Artist", 234);
    ListViewAddColumn(handle, 3, "Album", 234);
    ListViewAddColumn(handle, 4, "Genre", 218);
    
    ContextMenu = CreatePopupMenu();
    InsertMenu(ContextMenu, 0, MF_BYPOSITION | MF_STRING, IDM_CONTEXTSAVESONG, "Save Song(s)...");
    InsertMenu(ContextMenu, 1, MF_BYPOSITION | MF_STRING, IDM_CONTEXTCHECKSELECTED, "Check Selected Items");
    InsertMenu(ContextMenu, 2, MF_BYPOSITION | MF_STRING, IDM_CONTEXTUNCHECKSELECTED, "Uncheck Selected Items");
    
    Scale();
}
コード例 #21
0
ファイル: KeyTrans.c プロジェクト: suriyanr/Keytrans
void ShowContextMenu(HWND hWnd) {
POINT pt;
HMENU hMenu;

   GetCursorPos(&pt);
   hMenu = CreatePopupMenu();

   if (hMenu) {
      if (HookEnabled == 1) {
         InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_DISABLE, "Disable");
      }
      else {
         InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_ENABLE, "Enable");
      }
      InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_EXIT, "Exit");

      SetForegroundWindow(hWnd);
      TrackPopupMenu(hMenu, TPM_BOTTOMALIGN,
                     pt.x, pt.y, 0, hWnd, NULL );
      DestroyMenu(hMenu);
   }
}
コード例 #22
0
//*************************************************************
//
//  PlaceMenuMRUItem()
//
//  Purpose:
//              Add MRU at the end of a menu
//
//  Parameters:
//      LPMRUMENU lpMruMenu -      pointer on MRUMENU
//      HMENU hMenu -              Handle of menu where MRU must be added
//      UINT uiItem -              Item of menu entry where MRU must be added
//
//  Return: void
//
//
//  Comments:
//      Used MRU is modified, for refresh the File menu
//
//  History:    Date       Author       Comment
//              09/24/94   G. Vollant   Created
//
//*************************************************************
void PlaceMenuMRUItem (LPMRUMENU lpMruMenu, HMENU hMenu, UINT uiItem)
{
int  i;   
WORD wNbShow;

	if (hMenu == NULL) return;

// "Liste ..." entfernen
	RemoveMenu (hMenu, lpMruMenu->wIdMru-1, MF_BYCOMMAND);

// remove old MRU in menu
	for (i = 0; i <= (int)(lpMruMenu->wNbLruMenu); i++)
		RemoveMenu (hMenu, i+lpMruMenu->wIdMru, MF_BYCOMMAND);

// If they are item, insert a separator before the files
	InsertMenu (hMenu,uiItem,MF_SEPARATOR,lpMruMenu->wIdMru,NULL);
  
	if (lpMruMenu->wNbItemFill == 0) {
	ResString resMRU (IDS_EMPTYMRU, 32);

		InsertMenu (hMenu, lpMruMenu->wIdMru, MF_STRING|MF_GRAYED, 
				    lpMruMenu->wIdMru-1, resMRU);
	} else {
		wNbShow = min(lpMruMenu->wNbItemFill,lpMruMenu->wNbLruShow);
		for (i = (int)wNbShow-1; i >= 0; i--) {
		LPSTR lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20];
			
			if (lpTxt) {
				wsprintf (lpTxt,"&%lu %s",
							(DWORD)(i+1), 
							lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem*(UINT)i));
				InsertMenu (hMenu,(((WORD)i) != (wNbShow-1)) ? (lpMruMenu->wIdMru+i+2) : lpMruMenu->wIdMru,
						MF_STRING, lpMruMenu->wIdMru+i+1,lpTxt);   
				delete lpTxt;
			}
		}
	}
}
コード例 #23
0
ファイル: MainFrm.cpp プロジェクト: victimofleisure/WaveShop
LRESULT CMainFrame::OnPluginsFound(WPARAM wParam, LPARAM lParam)
{
	CDocTemplateIter	iter;
	CMultiDocTemplate	*tpl = (CMultiDocTemplate *)iter.GetNextDocTemplate();
	ASSERT(tpl != NULL);	// at least one document template must exist
	// insert plugin popup menu into main menu associated with document type
	HMENU	PluginMenu = m_PluginMgr.GetMenu();
	UINT	flags = MF_BYPOSITION | MF_POPUP;
	if (!InsertMenu(tpl->m_hMenuShared, 5, flags, int(PluginMenu), _T("&Plugin")))
		AfxThrowResourceException();
	if (m_View != NULL)	// if at least one document open
		DrawMenuBar();	// document menu must be showing, so repaint it
	return(0);
}
コード例 #24
0
void ShowContextMenu(HWND hWnd)
{
	POINT pt;
	GetCursorPos(&pt);
	HMENU hMenu = CreatePopupMenu();
	if(hMenu)
	{
		int indexMenu=0;
		InsertMenu(hMenu, indexMenu++, MF_BYPOSITION, WM_SHOWCONSOLEWINDOW, "Show/Hide Console Window");
		CheckMenuItem(hMenu,WM_SHOWCONSOLEWINDOW,(myconsole.IsConsoleVisible())?MF_CHECKED:MF_UNCHECKED);

		InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);
		InsertMenu(hMenu, indexMenu++, MF_BYPOSITION, WM_TRAYEXIT, "E&xit");

		// note:	must set window to the foreground or the
		//			menu won't disappear when it should
		SetForegroundWindow(hWnd);

		TrackPopupMenu(hMenu, TPM_BOTTOMALIGN,
			pt.x, pt.y, 0, hWnd, NULL );
		DestroyMenu(hMenu);
	}
}
コード例 #25
0
ファイル: ShellUi.cpp プロジェクト: menghang/YoloMouse
    void ShellUi::AddMenu()
    {
        xassert(_hwnd);

        // create shell icon
        _ShellIconCreate();

        // create popup menu
        _menu = CreatePopupMenu();

        // add exit option
        InsertMenu( _menu, 0, MF_BYPOSITION | MF_STRING, ID_EXIT, L"E&xit" );
        SetMenuDefaultItem( _menu, ID_EXIT, FALSE );
    }
コード例 #26
0
STDMETHODIMP CBkgndCtxMenuExt::QueryContextMenu (
                                 HMENU hmenu, UINT uIndex, UINT uidCmdFirst,
                                 UINT uidCmdLast, UINT uFlags )
{
UINT uCmdID = uidCmdFirst;

    // First insert item 0 - the English version.

    InsertMenu ( hmenu, uIndex, MF_BYPOSITION, uCmdID++, _T("CLICK HERE!") );

    // uIndex seems to be -1 all the time (tested on 98 and 2K).  If it _is_ -1,
    // we can't increment it, 'cause it would overflow to 0, which would make our
    // second item appear at the _top_ of the menu.

    if ( 0xFFFFFFFF != uIndex )
        uIndex++;

    // Then insert item 1 - the French version.

    InsertMenu ( hmenu, uIndex, MF_BYPOSITION, uCmdID, _T("CLIQUEZ ICI!") );

    return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 2 );
}
コード例 #27
0
ファイル: EsteidShlExt.cpp プロジェクト: Krabi/idkaart_public
STDMETHODIMP CEsteidShlExt::QueryContextMenu (
	HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
	UINT uidLastCmd, UINT uFlags )
{
	// If the flags include CMF_DEFAULTONLY then we shouldn't do anything.
	if (uFlags & CMF_DEFAULTONLY)
		return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);

	InsertMenu(hmenu, uMenuIndex, MF_STRING | MF_BYPOSITION, uidFirstCmd, _T("Allkirjasta ID-kaardiga"));
	if (m_DigidocBmp != NULL)
		SetMenuItemBitmaps(hmenu, uMenuIndex, MF_BYPOSITION, m_DigidocBmp, NULL);

	return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 1);
}
コード例 #28
0
STDMETHODIMP
CShellExtension::QueryContextMenu(
	HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
	UINT uidLastCmd, UINT uFlags)
{
	OutputDebugString(TEXT("Menu Queried"));
	// If the flags include CMF_DEFAULTONLY then we shouldn't do anything.
	if (uFlags & CMF_DEFAULTONLY)
		return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);

	InsertMenu(hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("Menu Test Item"));

	return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 1);
}
コード例 #29
0
ファイル: systray.cpp プロジェクト: pprov/menumod
	BOOL ShowPopupMenu(HWND hWnd, POINT *curpos, int wDefaultItem)
	{
		HMENU hPop = CreatePopupMenu();
		InsertMenu(hPop, 0, MF_BYPOSITION | MF_STRING, ID_OPTIONS, _T("Settings..."));
		InsertMenu(hPop, 1, MF_BYPOSITION | MF_STRING, ID_EXIT, _T("Exit MenuMod"));

		SetMenuDefaultItem(hPop, ID_OPTIONS, FALSE);
		SetFocus(hWnd);
		SendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hPop, 0);

		if (!curpos)
		{
			POINT pt;
			GetCursorPos(&pt);
			curpos = &pt;
		}

		WORD cmd = TrackPopupMenu(hPop, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, curpos->x, curpos->y, 0, hWnd, NULL);
		SendMessage(hWnd, WM_COMMAND, cmd, 0);
		
		DestroyMenu(hPop);
		return 0;
	}
コード例 #30
0
ファイル: vfdshmenu.cpp プロジェクト: Sattvic2/OSDEV
//
//	local functions
//
static void AddMenuItem(
	HMENU			hMenu,
	UINT			uPos,
	UINT			uFlags,
	UINT			uCmd,
	UINT			uText)
{
	PSTR text = ModuleMessage(uText);

	if (text) {
		InsertMenu(hMenu, uPos, uFlags, uCmd, text);
		LocalFree(text);
	}
}