BCB 播放PPT时遇到问题 请教大家
时间:2011-12-09
来源:互联网
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Variant vPowerPoint;
LPCTSTR lpFileName = "aa.ppt";
try
{
vPowerPoint = CreateOleObject( "PowerPoint.Application ");
}
catch(...)
{
ShowMessage( "Error... ");
}
// 使 Powerpoint 界面可视
vPowerPoint.OlePropertySet( "Visible ", true);
// Powerpoint的版本
String strVersion = vPowerPoint.OlePropertyGet( "Version ");
// 打开一个剪辑
vPowerPoint.OlePropertyGet( "Presentations ").OleFunction( "Open ", lpFileName, false, false, true);
vPowerPoint.OlePropertySet( "Visible ", false);
// 幻灯片总数
int nSlidesCount = vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "Slides ").OlePropertyGet( "Count ");
// 放映这个剪辑
vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "SlideShowSettings ").OleFunction( "Run ");
// 设置播放大小
//SetPptSize(); //还没有改变窗口大小的时候PPT会全屏显示
Variant vSlideShowWin = vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "SlideShowWindow ");
for(int i=0; i <nSlidesCount;i++)
{
// 下一个幻灯片
vSlideShowWin.OlePropertyGet( "View ").OleFunction( "Next ");
}
// 关闭Powerpoint
vPowerPoint.OleProcedure( "Quit ");
vPowerPoint = Unassigned;
}
编译没问题,但运行时提示“无效的类别字符串”,请大家过目。
{
Variant vPowerPoint;
LPCTSTR lpFileName = "aa.ppt";
try
{
vPowerPoint = CreateOleObject( "PowerPoint.Application ");
}
catch(...)
{
ShowMessage( "Error... ");
}
// 使 Powerpoint 界面可视
vPowerPoint.OlePropertySet( "Visible ", true);
// Powerpoint的版本
String strVersion = vPowerPoint.OlePropertyGet( "Version ");
// 打开一个剪辑
vPowerPoint.OlePropertyGet( "Presentations ").OleFunction( "Open ", lpFileName, false, false, true);
vPowerPoint.OlePropertySet( "Visible ", false);
// 幻灯片总数
int nSlidesCount = vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "Slides ").OlePropertyGet( "Count ");
// 放映这个剪辑
vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "SlideShowSettings ").OleFunction( "Run ");
// 设置播放大小
//SetPptSize(); //还没有改变窗口大小的时候PPT会全屏显示
Variant vSlideShowWin = vPowerPoint.OlePropertyGet( "ActivePresentation ").OlePropertyGet( "SlideShowWindow ");
for(int i=0; i <nSlidesCount;i++)
{
// 下一个幻灯片
vSlideShowWin.OlePropertyGet( "View ").OleFunction( "Next ");
}
// 关闭Powerpoint
vPowerPoint.OleProcedure( "Quit ");
vPowerPoint = Unassigned;
}
编译没问题,但运行时提示“无效的类别字符串”,请大家过目。
作者: win98isme 发布时间: 2011-12-09
哪一行代码引起的,是不是
CreateOleObject( "PowerPoint.Application "); 多了个空格
CreateOleObject( "PowerPoint.Application "); 多了个空格
作者: ksrsoft 发布时间: 2011-12-09
是,但去掉后,提示未知名称
作者: win98isme 发布时间: 2011-12-09
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28