Prev: Can't Save PPT Presentation with Embedded Flash
Next: MS Producer - Can import the Powerpoint slides??
From: myjpa on 31 Jul 2007 04:36 Hi, I'm trying to catch ppt's events like SlideShowNextSlide, SlideShowNextClick, and PresentationOpen. I started the ppt application by using Powerpoint.Application COM object in "Microsoft Powerpoint 10.0 Object Library". I've failed to catch the event both by C# event binding routines and through IConnectionPointContainer and IConnectionPoint. I'm searching for a pure C# solution for catching the powerpoint application's events, but not a mixture solution of C# and VBA. This is my code, I'm wondering what the problem is in this code? public class PPTEventHandler { private PowerPoint.Application m_app; private Presentation m_pre; private UCOMIConnectionPoint m_connectionPoint; private int m_cookie; private void button1_Click(object sender, EventArgs e) { //...code to start ppt application omit... // QI for IConnectionPointContainer. UCOMIConnectionPointContainer oConnPointContainer = (UCOMIConnectionPointContainer)m_app; // Get the GUID of the EApplication interface. Guid guid = typeof(PowerPoint.EApplication).GUID; // Find the connection point. oConnPointContainer.FindConnectionPoint(ref guid, out m_connectionPoint); // Call Advise to sink up the connection. m_connectionPoint.Advise(this, out m_cookie); } //event handlers [DispId(2011)] public void SlideShowBegin(PowerPoint.SlideShowWindow Wn) { this.listBox1.Items.Add("SlideShowBegin"); } [DispId(2012)] public void SlideShowNextBuild(PowerPoint.SlideShowWindow Wn) { this.listBox1.Items.Add("SlideShowNextBuild"); } [DispId(2013)] public void SlideShowNextSlide(PowerPoint.SlideShowWindow Wn) { this.listBox1.Items.Add("SlideShowNextSlide"); } //other event handlers omit... } Thanks, |