Solved

COM Addin Bug?

Posted on 2000-03-05
10
462 Views
Last Modified: 2012-06-27
I am trying to get an answer from someone whether I have done something wrong, or whether there is a bug in the Outlook COM Addin handling. I have written a com addin and implemented the imspector objects, then problem is, when I close an inspector window using the save and close button or the send button, the Close Event of the inspector object does not get fired. This is a big problem, as this is when I need to free up certain objects. But I have asked newsgroups, microsoft officials and no one has given me an answer. Please help...
0
Comment
Question by:JazC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 2585899
Not sure how you have your code written, but the events will not fire if you just have the 'Dim WithEvents' statements.  Somewhere in your code you must assign an Inspector object the variable defined before you start receiving the notifications.

0
 

Author Comment

by:JazC
ID: 2585919
Well I'm using Delphi to do the code, but the thing is the event fires when you use the x or the close command on the menus, just not when using the buttons that I mentioned. Plus the activate and deactivate events are firing, so i'd say the code I have written is working OK. So really that just leaves a bug... doesn't it?
0
 

Author Comment

by:JazC
ID: 2585924
All the explorer events that i have trapped are working OK also, it really only seems to be the buttons that don't work. Has anyone tried this and either got it working fine, or having the same problem I am?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 16

Expert Comment

by:Neo_mvps
ID: 2585977
I would definitly say you found something.  Just to confirm w/ you that the same occurs under the OL2K VBA and from VB6.  The 'close' event does not fire when doing a 'send' on a mailitem or selecting 'save and close' on a contact item.
0
 
LVL 16

Accepted Solution

by:
Neo_mvps earned 200 total points
ID: 2586012
I would definitly say you found something.  Just to confirm w/ you that the same occurs under the OL2K VBA and from VB6.  The 'close' event does not fire when doing a 'send' on a mailitem or selecting 'save and close' on a contact item.
0
 

Author Comment

by:JazC
ID: 2586181
I wonder if there is any way around this?
0
 

Author Comment

by:JazC
ID: 2586185
I have tried talking to Darrique Barton(Outlook Program Manager) regarding this but he seems to refuse answering my emails.
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 2586231
Haven't found any yet... but have put a word to a couple of contacts to see if there is one.

Just so you know what code I am submitting to them...

Option Explicit

Dim WithEvents mobjInspector As Outlook.Inspector
Dim WithEvents mobjInspectors As Outlook.Inspectors

Private Sub Application_Startup()
  Set mobjInspectors = Application.Inspectors
End Sub

Private Sub mobjInspector_Activate()
  Debug.Print "Activate"
End Sub

Private Sub mobjInspector_Close()
  Debug.Print "Close"
End Sub

Private Sub mobjInspector_Deactivate()
  Debug.Print "Deactivate"
End Sub

Private Sub mobjInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
  Set mobjInspector = Inspector
End Sub

which was tested under the Corp/Workgroup mode of OL2K and Win2K.
0
 
LVL 3

Expert Comment

by:Catalys
ID: 10688838
JazC:

As a workaround, I would declare a module-level variable for a command bar (cmbBar) along with a WithEvent variable for a command bar button (cbbButtom);

When a new inspector is fired and its variable is instantiated, reference its own command bar with cmbBar, then you can trapp which button was used & reference it with cbbButton;

If cbbButton happens to refer to any of the close actions that SHOULD fire the object close event, you can then
call it, e.g.
0
 
LVL 3

Expert Comment

by:Catalys
ID: 10688885
...cont'd (force calling the Inspector Close Event)

If Not (instr(cbbButton.Caption,"Send") + instr(cbbButton, "Save & Close")) then
   mobjInspector_Close
End If

Hope this helps.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question