IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++Builder Discussion :

execution d'un fichier pps dans form ou un panel


Sujet :

C++Builder

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Par défaut execution d'un fichier pps dans form ou un panel
    bonjour à tous,

    J'aimerai éxecuter un fichier powerpoint dans une form ou dans un panel sous bcb.
    j'ai essayé d'utiliser les composants TOlecontainer, TpowerpointApplication et TpowerpointPrésentation, mais tous font éxecuter le fichier en plein écran !!!

    j'avais vu une solution en Delphi mais cela ne marche pas en bcb.

    merci de votre aide.

  2. #2
    Membre éclairé Avatar de Baxter67
    Profil pro
    Inscrit en
    Juin 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2005
    Messages : 270

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Par défaut
    Merci baxter67,

    J'ai bien fait des recherches mais les solutions ne conviennes pas car l'execution se fait toujours en plein ecran !!!

    Par contre ci-joint un bout de code qui pourrai convenir, mai comment enlever les scrollbars et mettre l'ecran sans bordure ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma link "PowerPoint_2K_SRVR"
    #pragma resource "*.dfm"
    TForm1 *Form1;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::LoadClick(TObject *Sender)
    {
        Variant FilePPS;
     
        if(OpenDialog->Execute())
            {
            FilePPS = OpenDialog->FileName;
            ptrFichierPPS = PowerPointApplication->Presentations->Open(FilePPS,(MsoTriState)0,(MsoTriState)0,(MsoTriState)0);
            }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::RUNClick(TObject *Sender)
    {
        int i, nbrSlide;
     
        // se connecte a poiwerpoint appilcation
        PowerPointPresentation->ConnectTo(ptrFichierPPS);
        // Init la presentation
        PowerPointPresentation->SlideShowSettings->ShowType = ppShowTypeWindow; //ppShowTypeSpeaker; //
        PowerPointPresentation->SlideShowSettings->ShowWithNarration = msoFalse;
        PowerPointPresentation->SlideShowSettings->StartingSlide = 1;
        nbrSlide = PowerPointPresentation->Slides->Count;
        PowerPointPresentation->SlideShowSettings->EndingSlide = nbrSlide;
        // definit la taille de la form
        PowerPointPresentation->Application->Height = Form1->Height;
        PowerPointPresentation->Application->Width  = Form1->Width;
     
        // on lance l'animation
        PowerPointPresentation->SlideShowSettings->Run();
     
        do
        {
        i = PowerPointApplication->ActivePresentation->SlideShowWindow->View->CurrentShowPosition;
        } while(i<=nbrSlide-1);
     
        PowerPointPresentation->Close();
        PowerPointApplication->Disconnect();
        PowerPointApplication->Quit();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::QUITClick(TObject *Sender)
    {
        PowerPointApplication->Quit();
        PowerPointApplication->Free();
        PowerPointPresentation->Free();
        Close();
    }
    //---------------------------------------------------------------------------

  4. #4
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Par défaut
    Salut samschu
    A ma connaissance le diaporama s'affiche toujours en plein ecran.
    Si en Delphi comme tu le dit il on reussi a contourner le probleme c'est peut etre possible de traduire le source en BCB

  5. #5
    Membre émérite
    Avatar de bandit boy
    Profil pro
    Inscrit en
    Février 2006
    Messages
    916
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 916
    Par défaut
    Salut,
    il existe une méthode en dérivant le CPPWebBrowser.
    Je l'utilise déjà et elle fonctionne très bien.

  6. #6
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 4
    Par défaut pour blondelle
    Re bonjour,

    Ben en fait avec le code que j'ai fourni, l'animation fonctionne bien dans un écran,

    Mais dans ce cas il y a les bords et le scrollbar qui gènent !!

    Autrement avec le TOlecontainer, comment faire pour lancer automatiquement l'animation sans faire un boubleclick ?

  7. #7
    Membre éclairé Avatar de Baxter67
    Profil pro
    Inscrit en
    Juin 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2005
    Messages : 270
    Par défaut
    Citation Envoyé par samschu Voir le message
    Merci baxter67,

    J'ai bien fait des recherches mais les solutions ne conviennes pas car l'execution se fait toujours en plein ecran !!!

    Par contre ci-joint un bout de code qui pourrai convenir, mai comment enlever les scrollbars et mettre l'ecran sans bordure ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma link "PowerPoint_2K_SRVR"
    #pragma resource "*.dfm"
    TForm1 *Form1;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::LoadClick(TObject *Sender)
    {
        Variant FilePPS;
     
        if(OpenDialog->Execute())
            {
            FilePPS = OpenDialog->FileName;
            ptrFichierPPS = PowerPointApplication->Presentations->Open(FilePPS,(MsoTriState)0,(MsoTriState)0,(MsoTriState)0);
            }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::RUNClick(TObject *Sender)
    {
        int i, nbrSlide;
     
        // se connecte a poiwerpoint appilcation
        PowerPointPresentation->ConnectTo(ptrFichierPPS);
        // Init la presentation
        PowerPointPresentation->SlideShowSettings->ShowType = ppShowTypeWindow; //ppShowTypeSpeaker; //
        PowerPointPresentation->SlideShowSettings->ShowWithNarration = msoFalse;
        PowerPointPresentation->SlideShowSettings->StartingSlide = 1;
        nbrSlide = PowerPointPresentation->Slides->Count;
        PowerPointPresentation->SlideShowSettings->EndingSlide = nbrSlide;
        // definit la taille de la form
        PowerPointPresentation->Application->Height = Form1->Height;
        PowerPointPresentation->Application->Width  = Form1->Width;
     
        // on lance l'animation
        PowerPointPresentation->SlideShowSettings->Run();
     
        do
        {
        i = PowerPointApplication->ActivePresentation->SlideShowWindow->View->CurrentShowPosition;
        } while(i<=nbrSlide-1);
     
        PowerPointPresentation->Close();
        PowerPointApplication->Disconnect();
        PowerPointApplication->Quit();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::QUITClick(TObject *Sender)
    {
        PowerPointApplication->Quit();
        PowerPointApplication->Free();
        PowerPointPresentation->Free();
        Close();
    }
    //---------------------------------------------------------------------------


    ah d'accord
    si jamais tu arrive a le faire en petit, tu peut me tenir au courant sa m'intéreeserais aussi
    Je vais un peu chercher de mon coté quand j'orais un peu le temps, mais bon la jai un deplacement donc sa va etre dur :S

  8. #8
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Par défaut
    je ne pensais pas que cela soit possible mais j'ai une solution qui n'est pas parfaite car elle laisse une barre noire sup et inf sur l'ecran, mais on peut dimensionner l'affichage
    Le code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
     
    //---------------------------------------------------------------------------
    #include <vcl.h>
    #pragma hdrstop
    #include "Unit1.h"
    #include <utilcls.h>
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
     Variant vMSPowerPoint, NameSpace;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
            : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
        // ne pas oublier d'inclure " #include <utilcls.h> "
    //    Variant vMSPowerPoint, NameSpace;
            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);
        vMSPowerPoint.OlePropertyGet("Presentations").OleFunction("Open", "C:\\Documents and Settings\\blondelle\\Mes documents\\PowerPoint\\Présentation1.ppt", false);
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("ShowType", 1); // 1, 2, NULL
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Top", 10);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Left", 10);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Height", 300);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Width", 300);
    }
    //---------------------------------------------------------------------------
    Si tu a le lien du code Delphi ce serait interressant de voir si l'on peut le traduire

  9. #9
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Par défaut
    On peut eliminer les bandes noires en ajustant les parametres de dimension d'affichage voici ce qui fonctionne chez moi sans bande noire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OlePropertySet("ShowType", 1); // 1, 2, NULL
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Top", 10);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Left", 10);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Height", 225);
    vMSPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run").OlePropertySet("Width", 300);
    }

Discussions similaires

  1. Entré de données dans fichier excel avec Form VB6
    Par avyrex dans le forum VB 6 et antérieur
    Réponses: 1
    Dernier message: 17/05/2007, 14h08
  2. Insertion fichier dans form
    Par valerie26 dans le forum Access
    Réponses: 1
    Dernier message: 28/08/2006, 22h25
  3. Fichiers BMP dans l'executable
    Par tryonyco dans le forum C++Builder
    Réponses: 10
    Dernier message: 30/06/2006, 10h47
  4. [Ajax] Execution d'un script javascript dans le fichier xml
    Par tonioz dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 30/06/2006, 08h00
  5. execution d une requete stockée dans un fichier
    Par ghostdog dans le forum Langage SQL
    Réponses: 2
    Dernier message: 18/10/2005, 16h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo