如何使用OLE或者TPowerPointApplication来播放PPT(PPS)格式的文件

meCAD 2006-07-08 09:20:31
不需要编辑,只需要打开并播放幻灯片即可.能响应上一页下一页的功能即可
...全文
626 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccrun.com 2006-08-05
  • 打赏
  • 举报
回复
OLE专业户来也!!!

用OLE操作PowerPoint

void __fastcall TestPowerPoint(LPSTR lpFileName)
{
Variant vPowerPoint;
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);
// 幻灯片总数
int nSlidesCount = vPowerPoint.OlePropertyGet("ActivePresentation")
.OlePropertyGet("Slides").OlePropertyGet("Count");
// 放映这个剪辑
vPowerPoint.OlePropertyGet("ActivePresentation")
.OlePropertyGet("SlideShowSettings").OleFunction("Run");
// 下一个幻灯片
Variant vSlideShowWin = vPowerPoint.OlePropertyGet("ActivePresentation")
.OlePropertyGet("SlideShowWindow");
vSlideShowWin.OlePropertyGet("View").OleFunction("Next");
// 跳到第二页
vSlideShowWin.OlePropertyGet("View").OleFunction("GoToSlide", 2);
// 返回上一页
vSlideShowWin.OlePropertyGet("View").OleFunction("Previous");
// 跳到最后一页
vSlideShowWin.OlePropertyGet("View").OleFunction("Last");
// 显示当前幻灯名称
String strSlideName = vSlideShowWin.OlePropertyGet("View")
.OlePropertyGet("Slide").OlePropertyGet("Name");
// 运行某个宏
vPowerPoint.OleFunction("Run", "'1.ppt'!Macro1");
// 关闭Powerpoint
vPowerPoint.OleProcedure("Quit");
vPowerPoint = Unassigned;
}
ljianq 2006-08-05
  • 打赏
  • 举报
回复
我也正在使用中,发现TOleContainer加载PowerPoint文档后,
OleContainer的OleObject竟然无效。
day_dreamerabc 2006-08-05
  • 打赏
  • 举报
回复
try
{
vPowerPoint = CreateOleObject("PowerPoint.Application");
}
catch(...)
{
ShowMessage("Error...");
}

如果没装PPT就会报错
meCAD 2006-08-05
  • 打赏
  • 举报
回复
to ccrun:
这个需要安装ppt吗?
constantine 2006-08-05
  • 打赏
  • 举报
回复
用那个webbrowser控件也可以
Waiting4you 2006-07-09
  • 打赏
  • 举报
回复
不用代码,直接在窗体里放一个TOleContainer,双击它就可以插入pps文件了
Waiting4you 2006-07-08
  • 打赏
  • 举报
回复
用 TOleContainer 把pps文件加载进去可以吗?
meCAD 2006-07-08
  • 打赏
  • 举报
回复
具体的代码怎么写?

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧