Solved

COM Addin Bug?

Posted on 2000-03-05
10
449 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

17 Experts available now in Live!

Get 1:1 Help Now