Solved

COM Addin Bug?

Posted on 2000-03-05
10
453 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
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Read this checklist to learn more about the 15 things you should never include in an email signature.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now