Ejemplo n.º 1
0
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);
}
Ejemplo n.º 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;
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
/*
 * 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;
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
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();
  }  
Ejemplo n.º 7
0
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);
	}
}
Ejemplo n.º 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 );
}
Ejemplo n.º 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 );
}
Ejemplo n.º 10
0
Archivo: ugView.c Proyecto: 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();
}
Ejemplo n.º 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;
}
Ejemplo n.º 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() );
        }
    }
}
Ejemplo n.º 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);
}
Ejemplo n.º 14
0
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();
}
Ejemplo n.º 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);
}
Ejemplo n.º 16
0
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));
}
Ejemplo n.º 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;
}
Ejemplo n.º 18
0
/*
================
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 );
    }
}
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);
        }
    }
}
Ejemplo n.º 20
0
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();
}
Ejemplo n.º 21
0
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);
   }
}
Ejemplo n.º 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;
			}
		}
	}
}
Ejemplo n.º 23
0
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);
}
Ejemplo n.º 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);
	}
}
Ejemplo n.º 25
0
    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 );
    }
Ejemplo n.º 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 );
}
Ejemplo n.º 27
0
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);
}
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);
}
Ejemplo n.º 29
0
	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;
	}
Ejemplo n.º 30
0
//
//	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);
	}
}