void __fastcall TForm2::Button1Click(TObject *Sender)
{
Variant vPowerPoint;
try
{
vPowerPoint = CreateOleObject("PowerPoint.Application");
}
catch(...)
{
ShowMessage("Error...");
}
// 使 Powerpoint 界面可视
vPowerPoint.OlePropertySet("Visible", true);
ShowMessage("运行到了此处caiguai");
// 打开一个剪辑
String strPptFile = "C:\\Users\\yujuan.ppt";
vPowerPoint.OlePropertyGet("Presentations")
.OleFunction("Open", strPptFile.c_str(), false, false, true);
ShowMessage("运行到了此处");
// 放映这个剪辑
vPowerPoint.OlePropertyGet("ActivePresentation")
.OlePropertyGet("SlideShowSettings").OleFunction("Run");
}
//---------------------------------------------------------------------------