Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2004

Tip: Looking for answers? Try searching our database.

Conditional displaying of top-level menu.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ilia Blank - 28 Nov 2004 13:29 GMT
Conditional displaying of top-level menu.

I have custom menu named WinFuse added to the list of Visual studio top
level menus (File, Edit, Build...).
The menu is created in ctc file as following:

   MENUS_BEGI
    guidDesignerVsPackageCmdSet:WinFuseMenu,        guidDesignerVsPackageCmdSet:WinFuseMenuGroup,
    0,
    ,
    "WinFuse",
    "WinFuse";
   MENUS_END

   NEWGROUPS_BEGI
    guidDesignerVsPackageCmdSet:WinFuseMenuGroup,    guidSHLMainMenu:IDM_VS_TOOL_MAINMENU,                0x0700;
   NEWGROUPS_END

WinFuse menu is displayed whenever visual studio starts.  I’d like to be
able to display (or to enable) the menu only when solution is opened. Please
provide me with general direction.

Best Regards
Ilia Blank.
Software developer

Jacada LTD.
"Ed Dore [MSFT]" - 29 Nov 2004 19:35 GMT
Hi Ilia,

You need to add an entry for your menu in the VISIBILITY section of the
CTC file. For example:

VISIBILITY_SECTION
   // Command, GUID when visible
   guidDesignerVsPackageCmdSet:WinFuseMenu, UICONTEXT_SolutionExists;
VISIBILITY_END

Note, the UICONTEXT_SolutionExists guid is defined in vsshlids.h. Query the
VSIP docs for VISIBILITY_SECTION for more details.

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
Ilia Blank - 01 Dec 2004 10:55 GMT
> Hi Ilia,
>
[quoted text clipped - 13 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.

Dear Ed,
It doesn't work for me.
I quote from VISIBILITY_SECTION section help on MSDN
"..This section only applies to commands and toolbars..".
guidDesignerVsPackageCmdSet:WinFuseMenu is top level menu
Does it make any difference?

Ilia
"Ed Dore [MSFT]" - 02 Dec 2004 22:49 GMT
Hi Ilia,

Can you post your .CTC file in it's entirety?

Thanks,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
Ilia Blank - 06 Dec 2004 12:35 GMT
Hi Ed
There it goes:

//--------------------------------------------------------------------------
#include "stdidcmd.h"
#include "vsshlids.h"
#include "msobtnid.h"
#include "virtkeys.h"
#include "PkgCmdID.h"
#include "Resource.h"

#define _CTC_GUIDS_
#include "Guids.h"

// shorthand macros for a more compact and manageable table

#define OI_NOID         guidOfficeIcon:msotcidNoIcon
#define DIS_DEF         DEFAULTDISABLED | DEFAULTINVISIBLE | DYNAMICVISIBILITY
#define VIS_DEF         COMMANDWELLONLY

CMDS_SECTION guidDesignerVsPackagePkg

   MENUS_BEGIN
       // NewMenu                                        Relative to Group                                    Priority    Type      
Name                        Tex
        guidDesignerVsPackageCmdSet:WinFuseMenu,        guidDesignerVsPackageCmdSet:WinFuseMenuGroup,        0,            ,            "WinFuse",                  "WinFuse"
        guidDesignerVsPackageCmdSet:ToolBarMenu,        guidDesignerVsPackageCmdSet:WinFuseToolbarGroup,    0,            TOOLBAR,    "WinFuse ToolBar",             "WinFuse"
//        guidDesignerVsPackageCmdSet:ToolBarServer,        guidDesignerVsPackageCmdSet:WinFuseToolbarGroup,    0,            TOOLBAR,    "WinFuse ToolBar",             "WinFuse Server";
   MENUS_END

   NEWGROUPS_BEGIN
       // NewGroup                                        Parent Group                                        Priorit
        guidDesignerVsPackageCmdSet:WinFuseMenuGroup,    guidSHLMainMenu:IDM_VS_TOOL_MAINMENU,                0x0700
        guidDesignerVsPackageCmdSet:WinFuseGroup,        guidDesignerVsPackageCmdSet:WinFuseMenu,            0x0700
        guidDesignerVsPackageCmdSet:WinFuseToolbarGroup,guidDesignerVsPackageCmdSet:WinFuseToolbarGroup,    0x0700
        guidDesignerVsPackageCmdSet:ToolBarGroup,        guidDesignerVsPackageCmdSet:ToolBarMenu,            0x0700
        guidDesignerVsPackageCmdSet:ToolBarServerGroup,    guidDesignerVsPackageCmdSet:ToolBarServer,            0x0700;       
   NEWGROUPS_END

   BUTTONS_BEGIN
   // Command                                            Parent Group                                        Priority    
Image                                                    Type        Visibility        
   
//guidDesignerVsPackageCmdSet:cmdidRepository,        guidSHLMainMenu:IDG_VS_WNDO_OTRWNDWS1,                0x0100,
   guidDesignerVsPackageCmdSet:bmpRepositoryToolWindow,    
BUTTON,                        ,            "WinFuse Repository";
    guidDesignerVsPackageCmdSet:cmdidRepository,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,        guidDesignerVsPackageCmdSet:bmpRepositoryToolWindow,
  BUTTON,                        ,            "WinFuse Repository"
    guidDesignerVsPackageCmdSet:GotoRepository            guidSHLMainMenu:IDG_VS_CODEWIN_NAVIGATETOLOCATION,    0x0100,        guidDesignerVsPackageCmdSet:bmpGotoRepository,            BUTTON,                        ,            "Go To WinFuse Repository";  
    //guidDesignerVsPackageCmdSet:cmdidServerOutput,    guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,        guidDesignerVsPackageCmdSet:bmpRepositoryToolWindow,    BUTTON,                        ,            "WinFuse Server Output";
   
guidDesignerVsPackageCmdSet:cmdidRecord,            guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpRecord,                    BUTTON,    
DEFAULTDISABLED,                "Start Recording";
   
//guidDesignerVsPackageCmdSet:cmdidCapture,            guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpCapture,                    BUTTON,    
DEFAULTDISABLED,                "Capture";    
   
guidDesignerVsPackageCmdSet:cmdidCaptureAll,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpCaptureAll,                BUTTON,    
DEFAULTDISABLED,                "Capture";
    //guidDesignerVsPackageCmdSet:cmdidRunWinHost,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpRunWinHost,                BUTTON,    
DEFAULTDISABLED,                "Run WinHost";    
    //guidDesignerVsPackageCmdSet:cmdidRunServer,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpRunWinServer,            BUTTON,    
DEFAULTDISABLED,                "Run WinFuse Server";
    guidDesignerVsPackageCmdSet:cmdidClassMapping,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpClassMapping,            BUTTON,    
DEFAULTDISABLED,                "Class Mapping";
    //guidDesignerVsPackageCmdSet:cmdidStopWinHost,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpStopWinHost,                BUTTON,    
DEFAULTDISABLED,                "Stop WinHost";   
    //guidDesignerVsPackageCmdSet:cmdidStopServer,        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpStopServer,                BUTTON,    
DEFAULTDISABLED,                "Stop WinFuse Server";
    guidDesignerVsPackageCmdSet:cmdidDeployToServer,    guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpDeployToServer,            BUTTON,    
DEFAULTDISABLED,                "Service Deployment";   
    guidDesignerVsPackageCmdSet:cmdidSettings,            guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpSettings,                BUTTON,    
DEFAULTDISABLED,                "WinFuse Settings";   
    //guidDesignerVsPackageCmdSet:cmdidRegenerateCode        guidDesignerVsPackageCmdSet:WinFuseGroup,            0x0100,        guidDesignerVsPackageCmdSet:bmpRegenerate,                BUTTON,      DEFAULTDISABLED,                "Regenerate WinFuse Code";   

    guidDesignerVsPackageCmdSet:cmdidRecordToolBar,        guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpRecord,                    BUTTON,    
DEFAULTDISABLED,                "Start Recording";
    //guidDesignerVsPackageCmdSet:cmdidCaptureToolBar,    
guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,    
guidDesignerVsPackageCmdSet:bmpCapture,                    BUTTON,    
DEFAULTDISABLED,                "Capture";    
    guidDesignerVsPackageCmdSet:cmdidCaptureAllToolBar,
guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,    
guidDesignerVsPackageCmdSet:bmpCaptureAll,                BUTTON,    
DEFAULTDISABLED,                "Capture";
    guidDesignerVsPackageCmdSet:cmdidRunWinHostToolBar,    guidDesignerVsPackageCmdSet:ToolBarServerGroup,        0x0100,
   guidDesignerVsPackageCmdSet:bmpRunWinHost,                BUTTON,    
DEFAULTDISABLED,                "Run WinHost";    
    guidDesignerVsPackageCmdSet:cmdidRunServerToolBar,    guidDesignerVsPackageCmdSet:ToolBarServerGroup,        0x0100,
   guidDesignerVsPackageCmdSet:bmpRunWinServer,            BUTTON,    
DEFAULTDISABLED,                "Run WinFuse Server";
    guidDesignerVsPackageCmdSet:cmdidClassMappingToolBar,
guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,        guidDesignerVsPackageCmdSet:bmpClassMapping,            BUTTON,    DEFAULTDISABLED,                "Class Mapping";
    guidDesignerVsPackageCmdSet:cmdidStopWinHostToolBar,
guidDesignerVsPackageCmdSet:ToolBarServerGroup,    0x0100,    
guidDesignerVsPackageCmdSet:bmpStopWinHost,                BUTTON,    
DEFAULTDISABLED,                "Stop WinHost";   
    guidDesignerVsPackageCmdSet:cmdidStopServerToolBar,    guidDesignerVsPackageCmdSet:ToolBarServerGroup,        0x0100,
   guidDesignerVsPackageCmdSet:bmpStopServer,                BUTTON,    
DEFAULTDISABLED,                "Stop WinFuse Server";
    guidDesignerVsPackageCmdSet:cmdidDeployToServerTB,    guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpDeployToServer,            BUTTON,    
DEFAULTDISABLED,                "Service Deployment";   
    guidDesignerVsPackageCmdSet:cmdidSettingsTB,        guidDesignerVsPackageCmdSet:ToolBarGroup,            0x0100,
   guidDesignerVsPackageCmdSet:bmpSettings,                BUTTON,    
DEFAULTDISABLED,                "WinFuse Settings";       
       
       // Those commands are not defined as shared command, so they use our
package CLSID
       // as the command set GUID. Also, by specifying blank for the FLAGS,
this command is
       // default visible and enabled. Other valid values for FLAGS are the
following:
       //    DEFAULTDISABLED, DEFAULTINVISIBLE, DYNAMICVISIBILITY,
TEXTCHANGES
       // These values for FLAGS can be or'ed together, e.g.
"DEFAULTINVISIBLE | DYNAMICVISIBILITY"
       // If you do not want an image next to your command, set the image
to "guidOfficeIcon:msotcidNoIcon"

   BUTTONS_END

   BITMAPS_BEGIN
       // Bitmap                          Bitmap Index, Bitmap Index, ...
   guidDesignerVsPackageCmdSet:IDB_MENU_IMAGES,    bmpPic1, bmpPic2,
bmpPicSmile, bmpPicX, bmpPicArrows, bmpRecord, bmpRepositoryToolWindow,
bmpRunWinHost, bmpRunWinServer, bmpClassMapping, bmpCapture, bmpCaptureAll,
bmpStopServer, bmpStopWinHost,bmpGotoRepository, bmpDeployToServer,
bmpSettings, bmpRegenerate;
   BITMAPS_END

CMDS_END

CMDUSED_SECTION
CMDUSED_END

CMDPLACEMENT_SECTION
   // Command                                        Group                                        Priority
    guidDesignerVsPackageCmdSet:cmdidRecord,        guidDesignerVsPackageCmdSet:ToolBarMenu,    1;
    guidDesignerVsPackageCmdSet:cmdidCapture,        guidDesignerVsPackageCmdSet:ToolBarMenu,    2;
    guidDesignerVsPackageCmdSet:cmdidCaptureAll,    guidDesignerVsPackageCmdSet:ToolBarMenu,    3;       
    guidDesignerVsPackageCmdSet:cmdidRunWinHost,    guidDesignerVsPackageCmdSet:ToolBarMenu,    4;
    guidDesignerVsPackageCmdSet:cmdidRunServer,        guidDesignerVsPackageCmdSet:ToolBarMenu,    5;
    guidDesignerVsPackageCmdSet:cmdidClassMapping,    guidDesignerVsPackageCmdSet:ToolBarMenu,    6;   
    guidDesignerVsPackageCmdSet:cmdidStopWinHost,    guidDesignerVsPackageCmdSet:ToolBarMenu,    7;       
    guidDesignerVsPackageCmdSet:cmdidStopServer,    guidDesignerVsPackageCmdSet:ToolBarMenu,    8;           
    //guidDesignerVsPackageCmdSet:cmdidRepository,    guidDesignerVsPackageCmdSet:ToolBarMenu,    9;           
    guidDesignerVsPackageCmdSet:cmdidDeployToServer,guidDesignerVsPackageCmdSet:ToolBarMenu,    10;
    guidDesignerVsPackageCmdSet:cmdidSettings,        guidDesignerVsPackageCmdSet:ToolBarMenu,    11;
    //guidDesignerVsPackageCmdSet:cmdidRegenerateCode,guidDesignerVsPackageCmdSet:ToolBarMenu,    12;       
       
CMDPLACEMENT_END

VISIBILITY_SECTION
   // Have to remove leading ';' to pass compilation :)
   // Command                          GUID when visible    
   guidDesignerVsPackageCmdSet:WinFuseMenu, UICONTEXT_SolutionExists
VISIBILITY_END

//////////////////////////////////////////////////////////////////////////////
// KEYBINDINGS_SECTION
//
// This sections defines the keystroke mappings for the commands.
//
// The Keystate field is done using the following:
//    A = Alt, S = Shift, C = Control, W = Windows Key
//
// Example of the Keystate assignment, if you want a two key combination
// of Ctrl-X, Ctrl-Shift-C then the syntax would be :
//
//    'x':C:'c':CS
//
//////////////////////////////////////////////////////////////////////////////

KEYBINDINGS_SECTION
    // Command                        when available          emulation               keystate
KEYBINDINGS_END
//---------------------------------------------------------------------------------------------

> Hi Ilia,
>
[quoted text clipped - 4 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights
scout - 08 Dec 2004 04:30 GMT
Of Topic:

Ilia, can you tell how is your company doing with your new product?
have you manage to get new major customers? Are customer happy with it?
Thanks
Ilia Blank - 14 Dec 2004 16:39 GMT
This is brand new project. With no customer... yet.

> Of Topic:
>
> Ilia, can you tell how is your company doing with your new product?
> have you manage to get new major customers? Are customer happy with it?
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.