471,596 Members | 926 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

Problems with Events in PowerPoint-AddIn

I created a VB.NET-PowerPoint-AddIn as described in the VisualStudio
2003 documentation. That works very well.

The AddIn adds a new toolbar to PowerPoint if the active document is
based on a certain master. So I had to catch all events that notify a
change of the active presentation.

For that, I made two approaches:

1. A method that handles the apropriate events directly via HANDLES:

Private Sub WindowActivate(ByVal ppPres As PowerPoint.Presentation,
ByVal Wn As PowerPoint.DocumentWindow) Handles
applicationObject.WindowActivate, applicationObject.WindowDeactivate
End Sub

2. A more complicated approach with <DispId(xx)> that works better, as I
get a WindowChanged-event:

<DispId(2009)> Public Sub WindowChanged(ByVal ppPres As
PowerPoint.Presentation, ByVal Wn As PowerPoint.DocumentWindow)
End Sub

For this to work I had to declare this in the OnStartupComplete method:

' sink application events
Dim oConnPointContainer As UCOMIConnectionPointContainer
' QI for IConnectionPointContainer.
oConnPointContainer = CType(applicationObject,
' Create a new variable that contains the GUID of the
' PowerPoint.EApplication interface.
Dim guid As New Guid("914934C2-5A91-11CF-8700-00AA0060263B")
' Find the connection point.
oConnPointContainer.FindConnectionPoint(Guid, m_oConnectionPoint)
' Call Advise to sink up the connection.
m_oConnectionPoint.Advise(Me, m_Cookie)

and this in the OnDisconnection method:

' Call Unadvise to remove the sink to the connection.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(applicationObject)

Both approaches work, but they both somehow circumvent PowerPoint's
native check for the document beeing saved. I think I would have to
forward the event to PowerPoint after my method for it has been called,
but I have no idea how to do this.

Any hints?

Nov 21 '05 #1
0 1500

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by C Williams | last post: by
2 posts views Thread by WillRead | last post: by
reply views Thread by Marc Eggenberger | last post: by
1 post views Thread by Kishor | last post: by
6 posts views Thread by BWPanda | last post: by
1 post views Thread by chrizstone | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.