 |
Club Builder Foro de C++Builder en español
|
| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
Cris Cdt


Registrado: 24 Jul 2007Mensajes: 5
|
Publicado: Mar 24 Jul, 2007 3:58 am Asunto: Power Point - Delphi para C++Builder |
|
|
Necesito ayuda para traducir este código de Delphi para C++Builder
| Código: |
uses
comobj;
procedure TForm1.Button2Click(Sender: TObject);
var
PowerPointApp: OLEVariant;
begin
try
PowerPointApp := CreateOleObject('PowerPoint.Application');
except
ShowMessage('Error...');
Exit;
end;
// Make Powerpoint visible
PowerPointApp.Visible := True;
// Show powerpoint version
ShowMessage(Format('Powerpoint version: %s',[PowerPointApp.Version]));
// Open a presentation
PowerPointApp.Presentations.Open('c:\MyPresentation.ppt', False, False, True);
// Show number of slides
ShowMessage(Format('%s slides.',[PowerPointApp.ActivePresentation.Slides.Count]));
// Run the presentation
PowerPointApp.ActivePresentation.SlideShowSettings.Run;
// Go to next slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Next;
// Go to slide 2
PowerPointApp.ActivePresentation.SlideShowWindow.View.GoToSlide(2);
// Go to previous slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Previous;
// Go to last slide
PowerPointApp.ActivePresentation.SlideShowWindow.View.Last;
// Show current slide name
ShowMessage(Format('Current slidename: %s',[PowerPointApp.ActivePresentation.SlideShowWindow.View.Slide.Name]));
// Close Powerpoint
PowerPointApp.Quit;
PowerPointApp := UnAssigned;
end;
|
gracias |
|
| Volver arriba |
|
 |
_Leo Site Admin

Registrado: 11 Ago 2002Mensajes: 1875Ubicación: Lanzarote - Islas Canarias (España)
|
Publicado: Mar 24 Jul, 2007 3:55 pm Asunto: |
|
|
| Código: | // Añadimos la cabecera: #include <ComObj.hpp>
Variant PowerPointApp;
try {
PowerPointApp = CreateOleObject("PowerPoint.Application");
}
catch(...) {
ShowMessage("Error...");
return;
}
// Make Powerpoint visible
PowerPointApp.OlePropertySet("Visible", true);
// Show powerpoint version
ShowMessage(Format("Powerpoint version: %s", ARRAYOFCONST((
PowerPointApp.OlePropertyGet("Version")))));
// Open a presentation
Variant ActivePresentation = PowerPointApp.OlePropertyGet("Presentations")
.OleFunction("Open", "c:\\MyPresentation.ppt", false, false, true);
// Show powerpoint version
ShowMessage(Format("%s slides.", ARRAYOFCONST((ActivePresentation
.OlePropertyGet("Slides").OlePropertyGet("Count")))));
// Run the presentation
ActivePresentation.OlePropertyGet("SlideShowSettings").OleProcedure("Run");
// Go to next slide
Variant View = ActivePresentation.OlePropertyGet("SlideShowWindow").OlePropertyGet("View");
View.OleProcedure("Next");
// Go to slide 2
View.OleProcedure("GoToSlide", 2);
// Go to previous slide
View.OleProcedure("Previous");
// Go to last slide
View.OleProcedure("Last");
// Show current slide name
ShowMessage(Format("Current slidename: %s", ARRAYOFCONST((
View.OlePropertyGet("Slide").OlePropertyGet("Name")))));
// Close Powerpoint
PowerPointApp.OleProcedure("Quit"); |
|
|
| Volver arriba |
|
 |
Cris Cdt


Registrado: 24 Jul 2007Mensajes: 5
|
Publicado: Mie 25 Jul, 2007 1:31 am Asunto: |
|
|
| Muchas gracias por tu ayuda. ¡Quedó perfecto! |
|
| Volver arriba |
|
 |
|
|
No puedes publicar temas nuevos en este foro No puedes responder a temas en este foro No puedes editar tus mensajes en este foro No puedes borrar tus mensajes en este foro No puedes votar en las encuestas de este foro
|
© 2002–2026 Club Builder · Funciona con phpBB.
|