Pablo Galiano : Thursday, May 17, 2007 - Posts

Subscriptions

<July 2010>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

News

Subscribe to Pablo Galiano by Email

Post Categories

Thursday, May 17, 2007 - Posts

VSCT the new format

Visual Studio defines menus, groups and buttons by using a command table configuration (.ctc) file. This a is a text file with a pseudo C++  format that describes the command set for a VSPackage. A .ctc file is compiled into .cto by the ctc compiler (ctc.exe) and then embeded into a satellite assembly.

Here is how a CTC looks like:

  NEWGROUPS_BEGIN
 // NewGroup                              Parent Group                            Priority

    guidPackageBrowserCommand:grpidPackageBrowserCommandGroup, guidPackageBrowserCommandParentGroup:grpidPackageBrowserCommandParentGroup, 0x0100;
  NEWGROUPS_END

  BUTTONS_BEGIN
 // Command                    Parent Group                Priority    Image            Type    Visibility       

    guidPackageBrowserCommand:cmdidPackageBrowserCommand, guidPackageBrowserCommand:grpidPackageBrowserCommandGroup, 0x0100, guidPackageBrowserCommandBitmap:1, BUTTON, , "Package Browser";
  BUTTONS_END

So we can say that the format is ugly, plus that we dont have intellisense, syntax coloring and other VS language features.

The succesor to the CTC is an xml-format based named VSCT. Because it is xml, it is easy to read and also we have the benefit of intellisense, syntax coloring and auto completion.

Here is how the VSCT looks like:

< Buttons >

  < Button guid ="guidPackageBrowserCommand"id="cmdidPackageBrowserCommand"priority="0x100"type="Button">

    < Parent guid ="guidPackageBrowserCommand"id="grpidPackageBrowserCommandGroup"/>

    < Icon guid ="guidPackageBrowserCommandBitmap"id="1"/>

    < Strings >

      < ButtonText >Package Browser</ButtonText>

    </ Strings >

  </ Button >

</ Buttons >

The VSCT is also compiled into a .cto file by the vsct compiler (vsct.exe) and then embeded into a satellite assembly.

 

Some pointers:

http://blogs.msdn.com/aaronmar/archive/2007/04/02/ctc-is-dead-long-live-vsct-part-1.aspx

http://blogs.msdn.com/aaronmar/archive/2007/05/11/ctc-is-dead-long-live-vsct-part-2.aspx

 

A walkthrough to convert a old fashioned CTC to a VSCT by Dmitri:

http://blog.neutron.sharpstyle.com/2007/05/09/adding-vsct-compilation-support-to-whidbey-vs-2005-projects/

 

Pablo

posted Thursday, May 17, 2007 11:33 PM by pga with 3 Comments

Creating a VS Service with VSIPFactory

Before focusing on the creation of a VS Service with VSIPFactory, some little background:

Now the steps to create a Service with VSIPFactory:

  • Enable VSIPFactory
  • Right click on the VSPackage Project
  • Choose VSIPFactory\Create\VS Service
  • Specify the Service Name
  • Provide the contract definition on the generated IService interface
  • Provide the contract implementation on the generated service class
  • Thats all :)

CreateService1.jpg

 

CreateService2.jpg

 

Pablo

posted Thursday, May 17, 2007 5:41 PM by pga with 0 Comments

Find any VS command GUID:ID pair

VS SP1 introduced a really useful feature that will allow us to find any command GUID:ID pair.

To enable the feature we need to:

  • Add the following registry information
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\General]
"EnableVSIPLogging"=dword:00000001
  • Open a new instance of VS

Example usage:

Suppose that you want to find the GUID:ID pair of the File\Open menu item:

  1. Click on the File menu
  2. Hover the mouse over the Open sub menu
  3. Press CTRL + SHIFT
  4. Click on the Open menu

You could also use VSIPFactory to enable the feature for you:

EnableVSIPLogging.png

Tip:

To get the content of the window you need to select the window and then press CTRL+C and paste it on a Notepad for example.

 

Pablo

posted Thursday, May 17, 2007 5:33 PM by pga with 2507 Comments