#include <vcl.h>
#include <utilcls.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonLOADClick(TObject *Sender)
{
try
{
// on récupére l'instance active.
vMSPowerPoint = Variant::GetActiveObject("PowerPoint.Application");
}
catch(...)
{
// sinon on crée une nouvelle instance
vMSPowerPoint = Variant::CreateObject("PowerPoint.Application");
}
// on rend Visible l'instance d'Excel que nous avons défini
vMSPowerPoint.OlePropertySet("Visible", true);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonCloseClick(TObject *Sender)
{
vMSPowerPoint.OleFunction("Quit");
vMSPowerPoint = Unassigned;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonRUNClick(TObject *Sender)
{
// parametrage de la visualisation
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("ShowType", 1);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("LoopUntilStopped", 0);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("ShowWithNarration", -1);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("ShowWithAnimation", -1);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("RangeType", 1);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("AdvanceMode", 2);
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertyGet("PointerColor").OlePropertySet("RGB", (255, 0, 0));
// charge le fichier
vMSPowerPoint.OlePropertyGet("Presentations").OleFunction("Open", "K:\\CodeGear\\Cbuilder\\TEST\\Test_PPT\\05.ppt", false);
// lancement de la visualisation du diaporama
vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run");
}
//---------------------------------------------------------------------------
Partager