开发者

PowerPoint.Application not raising events in C#

开发者 https://www.devze.com 2022-12-25 11:06 出处:网络
I have a simple application written in C# and .Net 2.0 that displays several PowerPoint 2003 files in a loop. (It is going to be used for a information board in our cafeteria)The application works fin

I have a simple application written in C# and .Net 2.0 that displays several PowerPoint 2003 files in a loop. (It is going to be used for a information board in our cafeteria) The application works fine on my development开发者_如何学Go machine but when I deploy it to another machine the events I have registered for SlideShowNextSlide and PresentationClose are never fired. I have tried registering the events with this method.

private void InitPPT()
    {
        app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide);
        app.PresentationClose += new Microsoft.Office.Interop.PowerPoint.EApplication_PresentationCloseEventHandler(app_PresentationClose);
        app.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(app_PresentationClose);
    }

And with this method that I found here:

private void InitPPT()
    {
        IConnectionPointContainer oConnPointContainer = (IConnectionPointContainer)app;
        Guid guid = typeof(Microsoft.Office.Interop.PowerPoint.EApplication).GUID;
        oConnPointContainer.FindConnectionPoint(ref guid, out m_oConnectionPoint);
        m_oConnectionPoint.Advise(this, out m_Cookie);            
    }

Do I need to register some dll's on the client machine or am I missing something.


I think this was due to the fact that I was trying to run my application from a local user account but impersonate a domain account so I could access network drives. I have changed my application so it only impersonates the domain account while preforming network operations and not at application startup.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号