Bonjour à tous,
je voudrais ouvrir un powerpoint dans une form a l'aide de la faq ici:
Mais lorsque j'arrive à la ligne d'ouverture du fichier j'ai une erreur d'exception.
Quelqu'un pourrait me dire pourquoi ?
Merci d'avance
Version imprimable
Bonjour à tous,
je voudrais ouvrir un powerpoint dans une form a l'aide de la faq ici:
Mais lorsque j'arrive à la ligne d'ouverture du fichier j'ai une erreur d'exception.
Quelqu'un pourrait me dire pourquoi ?
Merci d'avance
Salut makele
C'est normal le Debuger te signal que tu passe par un try/catch, tu poursuit soit par F8 en pas a pas, soit par F9
Bonjour Blondelle,
Merci pour ta réponse, le problème reste même quand je l'exécute en dehors de l'IDE !! tjrs une exception. :(
Pourtant je fais exactement comme tu le dis dans le tuto.
Tu pourrais fournir la classe et le message de l'exception ?
Peut tu donner la version de BCB, les includes que tu a fait, et si possible un bout de code
Voilà !
Je suis sous bcb6
Citation:
#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");
}
//---------------------------------------------------------------------------
Merci à vous ShaiLeTroll et Blondelle,
J'ai résolu le problème en réinstallant BCB, je ne sais pourquoi celui-ci à subitement buggué.
Merci encore :ccool: