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 / August 2006

Tip: Looking for answers? Try searching our database.

VS2003->2005: Problems getting CommandBarPopup from CommandBarCont

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dono - 28 Jul 2006 08:20 GMT
Greetings.
I recently inherited an addin designed for VS2003.
I was asked to get it running and update it in VS2005.
It is written in native C++.

I made sure to update the .rgs file so that it points to 8.0 instead of 7.1
. The addin compiles and displays in the Addin Manager. When enabled, it adds
in item to the Tools menu. Next, it is supposed to add a submenu to that.
This is where it fails.
I have tracked down the exact point at which it fails. Below is the relavent
code.

// Private field
POfcCommandBarControl m_pControlXMPopup;

// Inside a method to setup menu
POfcCommandBar pToolsBar;
POfcCommandBarControls pControls;
POfcCommandBars pBars;

// Get command bar interface
m_pDTE->get_CommandBars( (EnvDTE::_CommandBars**) &pBars);
// Acquire Tools menubar
pBars->get_Item( CComVariant( "Tools" ), &pToolsBar);
// Get controls
pToolsBar->get_Controls( &pControls);

// Create popup menu
pControls->Add( CComVariant( Office::msoControlPopup ), CComVariant(1),
CComVariant(), CComVariant(1), varFalse, &m_pControlXMPopup);

// !!! This fails in VS2005 !!!
// returns NULL
// QueryInterface returns E_NOINTERFACE
POfcQICCommandBarPopup pPopup = m_pControlXMPopup;

m_pControlXMPopup is non-null. The typedef resolves to
ATL::CComPtrBase<Office::CommandBarControl>. The assignment results in an
automatic call to CComQIPtr(__in_opt IUnknown* lp) {...} in atlcomcli.h. This
method calls QueryInterface and results in E_NOINTERFACE.

I need the POfcQICCommandBarPopup to call get_CommandBar() and then add new
items to it.

The code worked fine in VS2003, which is a little puzzling.
What is wrong here?
Are there any alternatives or workarounds?

Regards.
Carlos J. Quintero [VB MVP] - 08 Aug 2006 12:23 GMT
Be aware that VS.NET 2003 add-ins and VS 2005 addins use different Office
DLLs to provide the command bars. Create a simple add-in with the wizard in
each environment to know about them.

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> Greetings.
> I recently inherited an addin designed for VS2003.
[quoted text clipped - 50 lines]
>
> Regards.
Dono - 08 Aug 2006 14:56 GMT
> Be aware that VS.NET 2003 add-ins and VS 2005 addins use different Office
> DLLs to provide the command bars. Create a simple add-in with the wizard in
> each environment to know about them.

Thanks.
I have since resolved this issue.
The following page, while difficult to find, was quite useful:
http://msdn2.microsoft.com/en-us/library/ms165634.aspx

Regards

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.