VC 如何获取PPT一帧动画结束事件

kooex 2014-11-22 03:14:32
如何获取PPT一帧动画结束事件
...全文
1624 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
826625187 2017-02-17
  • 打赏
  • 举报
回复
@liuquancai1,非常感谢你的回答,解决了小弟的问题,我找PPT的guid一直没找到正确的,最后直接使用你代码中的,居然就找到连接点了,非常感谢。牛b
全才欧巴 2016-06-08
  • 打赏
  • 举报
回复
https://support.microsoft.com/zh-cn/kb/309294 或者参考这个看看,这是针对WORD的,其实都差不多。
全才欧巴 2016-06-03
  • 打赏
  • 举报
回复
其实说白了就是要自己定义一个事件处理类,然后挂接到事件连接点上,事件连接点上需要监听EApplication类的CLSID(uuid(914934C2-5A91-11CF-8700-00AA0060263B),)对应的事件。就这么简单。
全才欧巴 2016-06-03
  • 打赏
  • 举报
回复
IID号和事件的CLSID号可以用VC带的ole/com object viewer察看。
qq_35208119 2016-06-03
  • 打赏
  • 举报
回复
很有用,学习了
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
MSDN上的东西太烂了,只有VB的,要用VC获取office的事件,只能使用上面的方式,VB的例子完全不能用。
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
Note that the value of the IID_IMyPPTEventsHandler static constant is changed from the value that the Class Wizard originally generated. The value is changed to the following: static const IID IID_IMyPPTEventsHandler = {0x914934C2,0x5A91,0x11CF, {0x87,0x00,0x00,0xAA,0x00,0x60,0x26,0x3b}}; This is the GUID for the EApplication outgoing event interface for the PowerPoint Application class. Also, note that the dispatch map for this class maps the DISPIDs of the events to the event handler methods. In the Ppteventsdemo.cpp file, add the following #include statement #include "CApplication.h" before the following: #include "PPTEventsDemoDlg.h" Add the following lines of code at the top of the InitInstance method of the Ppteventsdemoapp.cpp file: if(!AfxOleInit()) { AfxMessageBox("Unable to initialize COM"); return FALSE; } back to the top Test the Application Press F5 to build and run the program. The dialog box appears. Click Launch PowerPoint. PowerPoint starts and becomes visible. Click Establish Connection Point and Register Sink to set up the event sinks. Create a new presentation in PowerPoint. The WindowActivate, NewPresentation, PresentationNewSlide, SlideSelectionChange, and WindowSelectionChange events fire. Start the slide show and play it through the end. The SlideShowBegin, SlideShowNextSlide, and SlideShowEnd events fire. Save the presentation. The PresentationBeforeSave and PresentationSave events fire. Close the presentation. The PresentationClose event fires, and the events that were triggered by PowerPoint 2002 and handled by the program appear in the list box. NOTE: These are the events that PowerPoint 2002 fires. You may not see some of these events in PowerPoint 2000. Click UnRegister Sink and Do Clean Up to disconnect the event sinks. Close the dialog box. back to the top References For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base: Q254009 INFO: PowerPoint 2000 Event Demonstration Available for Download Q308336 HOWTO: Use Automation to Create and Show a PowerPoint Presentation with Visual C++ .NET and MFC For more information on Office Automation, see the following Microsoft Office Development support site: Office Development Support Center http://support.microsoft.com/support/officedev back to the top Additional query words: Power Point NET events C++ MFC connection powerpoint Keywords: kbAutomation _IK11561 kbGrpDSO kbHOWTOmaster Issue Type: kbhowto Technology: kbVCsearch kbAudDeveloper kbPowerPtSearch kbPowerPt2000 kbPowerPt2002 kbZNotKeyword2 kbPowerPt2000Search kbPowerPt2002Search kbVCNET
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
In the Myppteventshandler.h file, forward declare the following class: class CPresentation; In the Myppteventshandler.h file, add the following members to the public declarations in the CMyPPTEventsHandler class: DWORD cookie; CListBox* m_pListBox; Add the following methods to the protected declarations in the CMyPPTEventsHandler class: void WindowSelectionChange(LPDISPATCH Pres); void WindowBeforeRightClick(LPDISPATCH Pres, VARIANT_BOOL* Cancel); void WindowBeforeDoubleClick(LPDISPATCH Pres, VARIANT_BOOL* Cancel); void PresentationClose ( LPDISPATCH Pres); void PresentationSave( LPDISPATCH Pres); void PresentationOpen( LPDISPATCH Pres); void NewPresentation( LPDISPATCH Pres); void PresentationNewSlide( LPDISPATCH Pres); void WindowActivate( LPDISPATCH Pres,LPDISPATCH Wn); void WindowDeactivate(LPDISPATCH Pres, LPDISPATCH Wn); void SlideShowBegin(LPDISPATCH Wn); void SlideShowNextBuild( LPDISPATCH Wn); void SlideShowNextSlide( LPDISPATCH Wn); void SlideShowEnd( LPDISPATCH Pres); void PresentationPrint(LPDISPATCH Pres); void SlideSelectionChanged(LPDISPATCH SldRange); void ColorSchemeChanged(LPDISPATCH SldRange); void PresentationBeforeSave(LPDISPATCH Pres, VARIANT_BOOL * Cancel); void SlideShowNextClick(LPDISPATCH Wn, LPDISPATCH nEffect); void PresentationPrint(LPDISPATCH Pres); These are the PowerPoint event handlers. NOTE: The following 4 event handlers are not available in PowerPoint 2000, and are not called if the client has PowerPoint 2000: void SlideSelectionChanged(LPDISPATCH SldRange); void ColorSchemeChanged(LPDISPATCH SldRange); void PresentationBeforeSave(LPDISPATCH Pres, VARIANT_BOOL * Cancel); void SlideShowNextClick(LPDISPATCH Wn, LPDISPATCH nEffect); Replace the entire contents of Myppteventshandler.cpp with the following: // MyPPTEventsHandler.cpp : implementation file. // #include "stdafx.h" #include "PPTEventsDemo.h" #include "MyPPTEventsHandler.h" // CMyPPTEventsHandler. IMPLEMENT_DYNAMIC(CMyPPTEventsHandler, CCmdTarget) CMyPPTEventsHandler::CMyPPTEventsHandler() { EnableAutomation(); } CMyPPTEventsHandler::~CMyPPTEventsHandler() { } void CMyPPTEventsHandler::OnFinalRelease() { // When the last reference for an Automation object is released, // OnFinalRelease is called. The base class automatically // deletes the object. Add additional cleanup required for your // object before you call the base class. CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CMyPPTEventsHandler, CCmdTarget) END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CMyPPTEventsHandler, CCmdTarget) DISP_FUNCTION_ID(CMyPPTEventsHandler,"WindowSelectionChange",2001,WindowSelectionChange,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler , "WindowBeforeRightClick", 2002 ,WindowBeforeRightClick, VT_EMPTY , VTS_DISPATCH VTS_BOOL) DISP_FUNCTION_ID(CMyPPTEventsHandler , "WindowBeforeDoubleClick", 2003 ,WindowBeforeDoubleClick, VT_EMPTY, VTS_DISPATCH VTS_BOOL) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationClose",2004,PresentationClose,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationSave",2005,PresentationSave,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationOpen",2006,PresentationOpen,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"NewPresentation",2007,NewPresentation,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationNewSlide",2008,PresentationNewSlide,VT_EMPTY, VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"WindowActivate",2009,WindowActivate,VT_EMPTY, VTS_DISPATCH VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"WindowDeactivate",2010,WindowDeactivate,VT_EMPTY, VTS_DISPATCH VTS_DISPATCH) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideShowBegin",2011,SlideShowBegin,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideShowNextBuild",2012,SlideShowNextBuild,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideShowNextSlide",2013,SlideShowNextSlide,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideShowEnd",2014,SlideShowEnd,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationPrint",2015,PresentationPrint,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideSelectionChanged",2016,SlideSelectionChanged,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"ColorSchemeChanged",2017,ColorSchemeChanged,VT_EMPTY, VTS_DISPATCH ) DISP_FUNCTION_ID(CMyPPTEventsHandler,"PresentationBeforeSave",2018,PresentationBeforeSave,VT_EMPTY, VTS_DISPATCH VTS_BOOL) DISP_FUNCTION_ID(CMyPPTEventsHandler,"SlideShowNextClick",2019,SlideShowNextClick,VT_EMPTY, VTS_DISPATCH VTS_DISPATCH ) END_DISPATCH_MAP() //The GUUID is different from the one originally generated by Class Wizard. This GUUID is the same as the one for the EApplication outgoing event interface. static const IID IID_IMyPPTEventsHandler = {0x914934C2,0x5A91,0x11CF, {0x87,0x00,0x00,0xAA,0x00,0x60,0x26,0x3b}}; BEGIN_INTERFACE_MAP(CMyPPTEventsHandler, CCmdTarget) INTERFACE_PART(CMyPPTEventsHandler, IID_IMyPPTEventsHandler, Dispatch) END_INTERFACE_MAP() // CMyPPTEventsHandler message handlers. void CMyPPTEventsHandler::WindowSelectionChange(LPDISPATCH Pres) { m_pListBox->AddString("WindowSelectionChange"); return ; } void CMyPPTEventsHandler::WindowBeforeRightClick(LPDISPATCH Pres, VARIANT_BOOL* Cancel) { m_pListBox->AddString("WindowBeforeRightClick"); return ; } void CMyPPTEventsHandler::WindowBeforeDoubleClick(LPDISPATCH Pres, VARIANT_BOOL* Cancel) { m_pListBox->AddString("WindowBeforeDoubleClick"); return; } void CMyPPTEventsHandler::PresentationClose ( LPDISPATCH Pres) { m_pListBox->AddString("PresentationClose"); return ; } void CMyPPTEventsHandler::PresentationSave( LPDISPATCH Pres) { m_pListBox->AddString("PresentationSave"); return ; } void CMyPPTEventsHandler::PresentationOpen( LPDISPATCH Pres) { m_pListBox->AddString("PresentationOpen"); return ; } void CMyPPTEventsHandler::NewPresentation( LPDISPATCH Pres) { m_pListBox->AddString("NewPresentation"); return ; } void CMyPPTEventsHandler::PresentationNewSlide( LPDISPATCH Pres) { m_pListBox->AddString("PresentationNewSlide"); return ; } void CMyPPTEventsHandler::WindowActivate( LPDISPATCH Pres,LPDISPATCH Wn) { m_pListBox->AddString("WindowActivate"); return ; } void CMyPPTEventsHandler::WindowDeactivate(LPDISPATCH Pres, LPDISPATCH Wn) { m_pListBox->AddString("WindowDeactivate"); return ; } void CMyPPTEventsHandler::SlideShowBegin(LPDISPATCH Wn) { m_pListBox->AddString("SlideShowBegin"); return; } void CMyPPTEventsHandler::SlideShowNextBuild( LPDISPATCH Wn) { m_pListBox->AddString("SlideShowNextBuild"); return ; } void CMyPPTEventsHandler::SlideShowNextSlide( LPDISPATCH Wn) { m_pListBox->AddString("SlideShowNextSlide"); return ; } void CMyPPTEventsHandler::SlideShowEnd( LPDISPATCH Pres) { m_pListBox->AddString("SlideShowEnd"); return; } void CMyPPTEventsHandler::PresentationPrint(LPDISPATCH Pres) { m_pListBox->AddString("PresentationPrint"); return; } //The following events are not available for PowerPoint 2000. void CMyPPTEventsHandler::SlideSelectionChanged(LPDISPATCH SldRange) { m_pListBox->AddString("SlideSelectionChanged"); return ; } void CMyPPTEventsHandler::ColorSchemeChanged(LPDISPATCH SldRange) { m_pListBox->AddString("ColorSchemeChanged"); return ; } void CMyPPTEventsHandler::PresentationBeforeSave(LPDISPATCH Pres, VARIANT_BOOL * Cancel) { m_pListBox->AddString("PresentationBeforeSave"); return; } void CMyPPTEventsHandler::SlideShowNextClick(LPDISPATCH Wn, LPDISPATCH nEffect) { m_pListBox->AddString("SlideShowNextClick"); return ; }
✇易木残阳 2016-05-30
  • 打赏
  • 举报
回复
顶顶顶 技术高
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
Add the following code to the handler for the Establish Connection Point and Register Sink button: ///*********************** Start of code to get connection point ************** // Declare the events that you want to catch. // // Look for the coclass for Application in the Msppt9.olb typelib, // then look for the word "source." The EApplication interface // is the next search target. When you find it, you will see the // following GUID for the event interface. // 914934C2-5A91-11CF-8700-00AA0060263B static const GUID IID_IEApplication = {0x914934C2,0x5A91,0x11CF, {0x87,0x00,0x00,0xAA,0x00,0x60,0x26,0x3b}}; // Steps for setting up events. // 1. Get the IConnectionPointContainer interface of the server. // 2. Call IConnectionPointContainer::FindConnectionPoint() // to find the event that you want to catch. // 3. Call IConnectionPoint::Advise() with the IUnknown // interface of your implementation of the events. HRESULT hr; // Get the (PPT) IConnectionPointContainer interface of the server. IConnectionPointContainer *pConnPtContainer; hr = pptapp.m_lpDispatch->QueryInterface( IID_IConnectionPointContainer, (void **)&pConnPtContainer ); if(FAILED(hr)) AfxMessageBox("Couldn't get IConnectionPointContainer interface."); ASSERT(!FAILED(hr)); // Find a connection point for the events that you are interested in. hr = pConnPtContainer->FindConnectionPoint( IID_IEApplication, &m_pConnectionPoint ); if(FAILED(hr)) AfxMessageBox("Couldn't find connection point via event GUID."); ASSERT(!FAILED(hr)); //Instantiate the sink object. m_sink = new CMyPPTEventsHandler(); //Update the list box when you obtain the events in the event handler. m_sink->m_pListBox = m_listBox; // Get the IUnknown interface of your event implementation. LPUNKNOWN pUnk = NULL; pUnk = m_sink->GetInterface(&IID_IUnknown); ASSERT(pUnk); // Setup advisory connection. hr = m_pConnectionPoint->Advise(pUnk, &m_sink->cookie); ASSERT(!FAILED(hr)); // Release the IConnectionPointContainer interface. pConnPtContainer->Release(); // *********************** End of code to get connection point ****************** Add the following code to a handler for the UnRegister Sink and Do Clean Up button: //Use the cookie to unregister the sink. m_pConnectionPoint->Unadvise(m_sink->cookie); m_pConnectionPoint->Release(); //Detach the application object from the server. pptapp.DetachDispatch(); Add the following code to the bottom of the constructor in the CPPTEventsDemoDlg class: m_pConnectionPoint = NULL; pptapp = NULL; Before you return from CPPTEventsDemoDlg::OnInitDialog, add the following line of code: //Get the MFC class pointer for the list box on the dialog box. m_listBox = (CListBox*) GetDlgItem(IDC_LIST1); Be sure that you place the following #include statements at the beginning of the Ppteventsdemodlg.cpp file: #include "stdafx.h" #include "CApplication.h" #include "MyPPTEventsHandler.h" #include "PPTEventsDemo.h" #include "PPTEventsDemoDlg.h" Forward declare the following classes in the Ppteventsdemodlg.h file: class CMyPPTEventsHandler; class CApplication; Add the following declarations as private members to CPPTEventsDemoDlg: IConnectionPoint* m_pConnectionPoint; CApplication pptapp; CMyPPTEventsHandler* m_sink; CListBox* m_listBox; In Class View in Project Explorer, right-click PPTEventsDemo, point to Add, and then click Add Class. In the AddClass dialog box, select MFC class under Templates, and then click Open. Type CMyPPTEventsHandler for the class name, select CCmdTarget for the base class, and then select Automation. For other fields, accept the defaults. Click Finish. This creates a new CMyPPTEventsHandler MFC class that is derived from CCmdTarget. This class is defined in the Myppteventshandler.h file and is implemented in Myppteventshandler.cpp. This is the Event Handler class that contains methods that are called in response to the PowerPoint events.
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
You can sink a PowerPoint event in your C++ application by calling IConnectionPointContainer::FindConnectionPoint to find the connection point for the desired event interface, and then IConnectionPoint::Advise with the IUnknown interface of your implementation for that event. back to the top Create a C++ Application to Handle PowerPoint Events Create a new dialog box-based application by using the Microsoft Foundation Classes (MFC) Application Wizard in Visual C++ .NET. Name your project PPTEventsDemo, and then accept the default settings. The dialog box is created by default, along with the corresponding Ppteventsdemodlg.cpp and Ppteventsdemodlg.h files. Add three buttons to your dialog box, and then name the buttons Launch PowerPoint, Establish Connection Point and Register Sink, and UnRegister Sink and Do Clean Up, respectively. Add a list box to the dialog box. The list box displays the names of the events as they occur. In the Project explorer window in Class View, right-click PPTEventsDemo, point to Add, and then click Add Class. In the Add Class dialog box, select MFC class from TypeLibrary and then click Open. This starts the Add Class from TypeLib wizard. Select Microsoft PowerPoint 10.0 object library (for PowerPoint 2002) or Microsoft PowerPoint 9.0 object library (for PowerPoint 2000) from the Available TypeLibraries drop-down list. The Interfaces list box displays all of the interfaces that the type library exposes. Select _Application and then click the > button. Accept the defaults and then click Finish. This generates the CApplication wrapper class, which is derived from COleDispatchDriver. The implementation and definition of this class is available in the Capplication.h file. In Visual Studio .NET, click Resource View on the View menu to show the PPTEventsDemo dialog box. Double-click Launch PowerPoint to show the Code View window for Ppteventsdemodlg.cpp, where an empty event handler has been inserted for the Click event of that button. Add the following code to the handler for the Launch PowerPoint button: if(!pptapp.CreateDispatch("Powerpoint.Application")) { AfxMessageBox("Could not create Powerpoint object."); return; } pptapp.put_Visible((long) 1);
全才欧巴 2016-05-30
  • 打赏
  • 举报
回复
HOW TO: Handle PowerPoint Events by Using Visual C++ .NET and MFC Knowledge Base HOW TO: Handle PowerPoint Events by Using Visual C++ .NET and MFC PSS ID Number: Q309309 Article Last Modified on 09-25-2002 -------------------------------------------------------------------------------- The information in this article applies to: Microsoft Visual C++ .NET (2002) Microsoft PowerPoint 2000 Microsoft PowerPoint 2002 -------------------------------------------------------------------------------- For a Microsoft Visual C# .NET version of this article, see Q308825 . For a Microsoft Visual Basic .NET version of this article, see Q308330 . IN THIS TASK SUMMARY PowerPoint Events Create a C++ Application to Handle PowerPoint Events Test the Application REFERENCES Summary This step-by-step article describes how to automate PowerPoint and handle events by using Visual C++ .NET. back to the top PowerPoint Events PowerPoint fires events in response to user actions or in response to some methods that are called through Automation. The Application object in the PowerPoint object model fires these events on its outgoing interface, EApplication. To view this interface and its methods, you can use the OLE/COM Object Viewer, as follows: On the Tools menu in Visual Studio .NET, select OLE/COM Object Viewer. Expand the node for Type Libraries and select Microsoft PowerPoint Object Library in the list. On the Object menu, select View to open the library in the ITypeLib Viewer. Expand the node for coclass Application and select EApplication. Note that EApplication is derived from IDispatch and is not the dispinterface that is commonly used as a source interface. If the source interface is a dispinterface, you can determine the dispatch identifiers (DISPIDs) for its methods by using the OLE/COM Object Viewer. However, because EApplication is not a dispinterface, you cannot determine the DISPIDs for PowerPoint events by examining the type library. The following table lists DISPIDs for the events that the PowerPoint 2000 and PowerPoint 2002 object models expose: DISPID Method Name PowerPoint 2002 Only 2001 WindowSelectionChange 2002 WindowBeforeRightClick 2003 WindowBeforeDoubleClick 2004 PresentationClose 2005 PresentationSave 2006 PresentationOpen 2007 NewPresentation 2008 PresentationNewSlide 2009 WindowActivate 2010 WindowDeactivate 2011 SlideShowBegin 2012 SlideShowNextBuild 2013 SlideShowNextSlide 2014 SlideShowEnd 2015 PresentationPrint 2016 SlideSelectionChanged x 2017 ColorSchemeChanged x 2018 PresentationBeforeSave x 2019 SlideShowNextClick x
Mr_Weng1989 2015-01-23
  • 打赏
  • 举报
回复
楼主做出来了没有?我现在也需要这个功能,求楼主共享一下
赵4老师 2015-01-23
  • 打赏
  • 举报
回复
全部显示

SlideShowNextSlide 事件
请参阅 应用于 示例 特性 
切换到下一张幻灯片立刻发生此事件。对于第一张幻灯片,此事件紧跟在 SlideShowBegin 事件之后发生。

Private Sub application_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

application   Application 类型的对象,在类模块中声明,自身具有事件。有关使用 Application 对象的事件的详细信息,请参阅使用 Application 对象的事件。

Wn   活动幻灯片放映窗口。

示例
本示例确定了发生 SlideShowNextSlide 事件后幻灯片的位置。如果下一张幻灯片是第三张幻灯片,则本示例将鼠标指针的类型更改为笔形且颜色更改为红色。

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

   Dim Showpos As Integer

   Showpos = Wn.View.CurrentShowPosition + 1
      If Showpos = 3 Then  
         With ActivePresentation.SlideShowSettings.Run.View
            .PointerColor.RGB = RGB(255, 0, 0)
            .PointerType = ppSlideShowPointerPen
         End With
      Else
         With ActivePresentation.SlideShowSettings.Run.View
            .PointerColor.RGB = RGB(0, 0, 0)
            .PointerType = ppSlideShowPointerArrow
         End With
      End If
End Sub
本示例将全局计数器变量的值设置为 0。然后计算此事件后幻灯片上的形状个数,确定哪些形状具有动画,并用每个形状的动画顺序和编号填充全局数组。

注意   本示例中创建的数组还用于 SlideShowNextBuild 事件示例中。

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

   Dim i as Integer, j as Integer, numShapes As Integer
   Dim objSld As Slide

   Set objSld = ActivePresentation.Slides _
        (ActivePresentation.SlideShowWindow.View _
        .CurrentShowPosition + 1)
      With objSld.Shapes
         numShapes = .Count
         If numShapes > 0 Then
            j = 1
            ReDim shpAnimArray(1 To 2, 1 To numShapes)
            For i = 1 To numShapes
               If .Item(i).AnimationSettings.Animate Then
                  shpAnimArray(1, j) = _
                     .Item(i).AnimationSettings.AnimationOrder
                     shpAnimArray(2, j) = i
                     j = j + 1
               End If
            Next
         End If
      End With
End Sub
赵4老师 2015-01-23
  • 打赏
  • 举报
回复
使用 Application 对象的事件 请参阅 特性 若要为 Application 对象的事件创建事件句柄,需要完成以下三个步骤: 在类模块中声明一个对象变量以响应事件。 编写特定的事件过程。 在另一模块中初始化声明的对象。 声明对象变量 在为 Application 对象的事件编写过程之前,必须新建一个类模块,然后声明一个具有事件的 Application 类型的对象。例如,假设已新建一个类模块且其名称为 EventClassModule。该新类模块包含以下代码。 Public WithEvents App As Application 编写事件过程 声明具有事件的新对象之后,该对象就会出现在类模块的“对象”列表中,然后就可以为此新对象编写事件过程。(当在“对象”列表中选择新对象时,“过程”列表中就会列出该对象的有效事件。)从“过程”列表中选择一个事件;就会在类模块中添加一个空过程。 Private Sub App_NewPresentation() End Sub 初始化声明的变量 在过程运行之前,必须将类模块中声明的对象(本示例中为 App)与 Application 对象相连。用户可以在任意模块中使用以下代码实现此处理过程。 Dim X As New EventClassModule Sub InitializeApp() Set X.App = Application End Sub 运行 InitializeApp 过程。当运行此过程后,类模块中的 App 对象就会指向 Microsoft PowerPoint 的 Application 对象,然后当事件发生时,类模块中的事件过程就会运行。 全部显示 SlideShowEnd 事件 请参阅 应用于 示例 特性 本事件幻灯片放映结束后——即最后一个 SlideShowNextSlide 事件后发生。 Private Sub application_SlideShowEnd(ByVal Pres As Presentation) application Application 类型的对象,在类模块中声明,自身具有事件。有关使用 Application 对象的事件的详细信息,请参阅使用 Application 对象的事件。 Pres 当发生此事件时关闭演示文稿。 说明 如果 SlideShowBegin 事件已发生,则 SlideShowEnd 事件总发生在幻灯片放映结束之前。用户可使用 SlideShowEnd 事件将 SlideShowBegin 事件中发生的任何属性设置和变量初始值恢复到最初的设置。 示例 本示例在幻灯片放映结束时关闭从第一张到第四张幻灯片的条目效果和自动定时换片幻灯片放映切换效果。本示例也将幻灯片设置为手动换片。 Private Sub App_SlideShowEnd(ByVal Pres As Presentation) With Pres.Slides.Range(Array(1, 4)) _ .SlideShowTransition .EntryEffect = ppEffectNone .AdvanceOnTime = msoFalse End With With Pres.SlideShowSettings .AdvanceMode = ppSlideShowManualAdvance End With End Sub

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧