Clearing an ADXCommandBarPopup hangs Outlook

Add-in Express™ Support Service
That's what is more important than anything else

Clearing an ADXCommandBarPopup hangs Outlook
Calling he Clear command on an ADXCommandBarPopup causes 100% CPU usag 
Bargholz Thomas




Posts: 242
Joined: 2006-12-18
I have added an adxOlExplorerCommandBar with a ADXCommandBarPopup on it.
Depending on the users actions, I wan't to change the content (the ADXCommandBarButton items) of the ADXCommandBarPopup. In order to do that I first clear it and then build up the items again. The problem is that when I call Clear() on the Controls collection of the ADXCommandBarPopup, Outlook hangs, using 100% CPU.

Another problem I have is that controls added run-time doesn't appear if the menu is visible. The code that adds new ADXCommandBarButton items, add the same items to both an adxOlExplorerCommandBar menu and an adxOlInspectorCommandBar menu. If I run the code with the adxOlExplorerCommandBar open, it doesn't change. If I then (after the code that changes the menubar has run) open an inspector, the adxOlInspectorCommandBar is correctly changed. So it appears that changes to a menubar iden't reflected on currently visible menubars. Is that by design? And what can I do to achieve what I want: To change the menubars runtime.
Posted 18 Dec, 2006 09:25:59 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Bargholz.

Please download the following examples to learn how you can add command bars and controls dynamically:
http://www.add-in-express.com/projects/oldynamiccontrolsexample-vs2005.zip
http://www.add-in-express.com/projects/oldyncommandbars.zip



P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 18 Dec, 2006 09:43:17 Top
Bargholz Thomas




Posts: 242
Joined: 2006-12-18
Hi, I've downloaded your sample code and have updated my project accordingly. However, I'm now getting a build error which I can't figure out:

The type 'Microsoft.Office.Core.CommandBars' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

It's on the following code:

this.CommandBarsObj = inspector.CommandBars;


It's in the DoClear method that I've copied directly from the sample project.

The demo (dynamiccontrolsexample-vs2005) builds just fine. I have the same references as the demo, so I'm puzzled why I'm getting this error. I have the same references to Office, Microsoft.Office.Interop.Outlook.dll and Microsoft.Vbe.Interop.dll from the OfficePIAs folder in the project. I have no other references to Office libraries.

Do you have any idea why this happens?
Posted 19 Dec, 2006 03:54:32 Top
Bargholz Thomas




Posts: 242
Joined: 2006-12-18
Okay I have discovered the problem:

My version of add-in express comes with an Office.dll PIA dated 15th december 2006 (the date I started the project) and a size of 212 KB.
The version of the office.dll PIA that came with your sample is dated 15th january 2005 and has a size of 219 KB.

So it appears that I have an old version of the Office PIA, which doesn't contain the necessary declarations.

The Office PIA's - are they taken from my PC or do add-in express supply their own version?
Posted 19 Dec, 2006 04:00:09 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
All PIAs are generated on your PC. The PIA from the example is a version independent PIA (Office 2000). To add PIAs for Office 2003 (v11.0.0.0) you can use the 'Add Reference' dialog of the add-in project.
Posted 19 Dec, 2006 10:57:00 Top