Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Visual Studio AddIn problem - adding a sub-menu to the Edit menu

Visual Studio AddIn problem - adding a sub-menu to the Edit menu

Scheduled Pinned Locked Moved C#
csharphelpvisual-studioquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Morrison
    wrote on last edited by
    #1

    Hi all, I wonder if anyone can help with a problem I am having with an AddIn I am writing for Visual Studio.NET I am try to add a submenu to the Edit menu with two items in it. I would assume this is done by creating a CommandBar of type vsCommandBarTypeMenu and specifying the Edit menu as the parent, such as the code below: CommandBar EditMenu = (CommandBar)applicationObject.CommandBars["Edit"]; ....... ......... CommandBar MySubMenu = (CommandBar)applicationObject.Commands.AddCommandBar("My Sub Menu", vsCommandBarType.vsCommandBarTypeMenu, EditMenu, 0); However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". What am I doing wrong here? Regards, Chris

    J N 2 Replies Last reply
    0
    • C Chris Morrison

      Hi all, I wonder if anyone can help with a problem I am having with an AddIn I am writing for Visual Studio.NET I am try to add a submenu to the Edit menu with two items in it. I would assume this is done by creating a CommandBar of type vsCommandBarTypeMenu and specifying the Edit menu as the parent, such as the code below: CommandBar EditMenu = (CommandBar)applicationObject.CommandBars["Edit"]; ....... ......... CommandBar MySubMenu = (CommandBar)applicationObject.Commands.AddCommandBar("My Sub Menu", vsCommandBarType.vsCommandBarTypeMenu, EditMenu, 0); However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". What am I doing wrong here? Regards, Chris

      J Offline
      J Offline
      jparsons
      wrote on last edited by
      #2

      Purely speculation but I think you need to register your .NET object as a COM object using the wrappers so that Visual Studio can gain access to it Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n

      1 Reply Last reply
      0
      • C Chris Morrison

        Hi all, I wonder if anyone can help with a problem I am having with an AddIn I am writing for Visual Studio.NET I am try to add a submenu to the Edit menu with two items in it. I would assume this is done by creating a CommandBar of type vsCommandBarTypeMenu and specifying the Edit menu as the parent, such as the code below: CommandBar EditMenu = (CommandBar)applicationObject.CommandBars["Edit"]; ....... ......... CommandBar MySubMenu = (CommandBar)applicationObject.Commands.AddCommandBar("My Sub Menu", vsCommandBarType.vsCommandBarTypeMenu, EditMenu, 0); However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". What am I doing wrong here? Regards, Chris

        N Offline
        N Offline
        Nick Parker
        wrote on last edited by
        #3

        Chris Morrison wrote: However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". It sounds as if the CLSID is not being found in the registry, thus it is not able to load the COM Server because it doesn't know it's location. Are you using a third-party component that hasn't been registered? If so, pull up a command prompt, navigate to the directory of your COM .dll and type the following:

        regsvr32 "[YourComponent.dll]"

        Not entirely sure this is your problem, however here are a few links that might be of some help: COMException Class[^] HRESULTs and Exceptions[^] Nick Parker - DeveloperNotes.com


        VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done.
        -Don Box

        C 1 Reply Last reply
        0
        • N Nick Parker

          Chris Morrison wrote: However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". It sounds as if the CLSID is not being found in the registry, thus it is not able to load the COM Server because it doesn't know it's location. Are you using a third-party component that hasn't been registered? If so, pull up a command prompt, navigate to the directory of your COM .dll and type the following:

          regsvr32 "[YourComponent.dll]"

          Not entirely sure this is your problem, however here are a few links that might be of some help: COMException Class[^] HRESULTs and Exceptions[^] Nick Parker - DeveloperNotes.com


          VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done.
          -Don Box

          C Offline
          C Offline
          Chris Morrison
          wrote on last edited by
          #4

          Nick Parker wrote: Chris Morrison wrote: However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". It sounds as if the CLSID is not being found in the regisry, thus it is not able to load the COM Server because it doesn't know it's location. Are you using a third-party component that hasn't been registered? If so, pull up a command prompt, navigate to the directory of your COM .dll and type the following: regsvr32 "[YourComponent.dll]" That did not work and caused an error. I would have thought that any registrations that were required would be performed when I build and debug the Add-In. Also I have added a floating toolbar to the IDE with no problems, and I can add new items directly to the Edit menu with out error, so I can't see why I am having problems adding a sub menu to it. This is very strange.:confused::mad: Chris

          H 1 Reply Last reply
          0
          • C Chris Morrison

            Nick Parker wrote: Chris Morrison wrote: However, when I try to add the CommandBar, a COMException is thrown with the message "Class not registered. Looking for object with CLID {.........}". It sounds as if the CLSID is not being found in the regisry, thus it is not able to load the COM Server because it doesn't know it's location. Are you using a third-party component that hasn't been registered? If so, pull up a command prompt, navigate to the directory of your COM .dll and type the following: regsvr32 "[YourComponent.dll]" That did not work and caused an error. I would have thought that any registrations that were required would be performed when I build and debug the Add-In. Also I have added a floating toolbar to the IDE with no problems, and I can add new items directly to the Edit menu with out error, so I can't see why I am having problems adding a sub menu to it. This is very strange.:confused::mad: Chris

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            Try running regasm.exe on your .NET assembly. It is equivalent to regsvr32.exe but is for managed assemblies. Since such assemblies do not export DllRegisterServer or DllUnregisterServer, regsvr32.exe is useless.

            -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

            N 1 Reply Last reply
            0
            • H Heath Stewart

              Try running regasm.exe on your .NET assembly. It is equivalent to regsvr32.exe but is for managed assemblies. Since such assemblies do not export DllRegisterServer or DllUnregisterServer, regsvr32.exe is useless.

              -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

              N Offline
              N Offline
              Nick Parker
              wrote on last edited by
              #6

              Heath Stewart wrote: Since such assemblies do not export DllRegisterServer or DllUnregisterServer, regsvr32.exe is useless. I would have suggested that but since it was throwing a COMException I figured it was due to a problem on the other side of the fence. :) Oh well, it's the weekend after all. :) -Nick Parker VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done.
              -Don Box

              H 1 Reply Last reply
              0
              • N Nick Parker

                Heath Stewart wrote: Since such assemblies do not export DllRegisterServer or DllUnregisterServer, regsvr32.exe is useless. I would have suggested that but since it was throwing a COMException I figured it was due to a problem on the other side of the fence. :) Oh well, it's the weekend after all. :) -Nick Parker VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done.
                -Don Box

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                VS.NET uses the DTE components via COM (even if written in managed code), so if it can't find the registered class (either because it wasn't registered correctly or because he moved the DLL after registering it) it would throw such a COMException.

                -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups