Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9235887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:09:30+00:00 2026-06-18T07:09:30+00:00

I am writing a Visual Studio 2012 extension that defines several sub-menus to go

  • 0

I am writing a Visual Studio 2012 extension that defines several sub-menus to go in two existing Visual Studio context menus. The sub-menu items appear to work correctly except for one thing:

Until the first menu item in my package is clicked, the state of each menu item is its default state depending on its definition in the VSCT file. That works fine for menu items that are always enabled, but some menu items should be enabled or disabled based on certain changing conditions. After the package is sited, their states are set correctly, but how can I get the states to be set correctly before the first item is clicked?

There is no default state that works in my solution. The conditions might be true or false the first time my menus appear.

If you have a solution for this, or know where this has been addressed in a tutorial somewhere, I would appreciate your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:09:31+00:00Added an answer on June 18, 2026 at 7:09 am

    I finally discovered the answer to my question at MSDN in an article called How to: Autoload a VSPackage. The “trick” is to set the ProvideAutoLoadAttribute on the package class that’s created for the project. Here is the declaration for one of the projects I am working on:

    [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
    [ProvideMenuResource("Menus.ctmenu", 1)]
    [ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")]
    [Guid(GuidList.guidXamlHelpmeetPkgString)]
    public sealed class XamlHelpmeetPackage : Package
    { ...
    

    The third line is all that I added to make the otherwise working extension load early rather than on demand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a (very) simple Visual Studio addin. Two things that would make it
Im writing a visual studio (2010) extension with a right click menu whilst in
I 'm writing a Visual Studio extension where I'm creating line adornments that need
I am writing a extension for visual studio, which will automatically generate some JS
I have started writing a Macro in Visual Studio 2005 like this: Public Sub
I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to
I'm writing a small Win32 application in Visual Studio C/C++ that talks to a
I am writing a small program in Visual Studio 11 (beta) that a console
I'm writing a Visual Studio toolbar Add-In that displays the current time. I have
I writing a report in Visual Studio that takes a user input parameter and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.