代码编译成EXE后运行提示:IsBound() @ c:\bcb\emuvcl\utilcls.h/4249

楚天舒1 2011-07-04 11:44:49
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "myFrom.h"
#include <windows.h>
#include <vcl\utilcls.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
pDBConfig = TDBConfig::getInstance();
char buffer[MAXPATH];
getcwd(buffer, MAXPATH);
String path = buffer; //GetPathAndBaseExeName();
pDBConfig->setAppPath(path);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Variant vPowerPoint;
try
{
vPowerPoint = CreateOleObject("PowerPoint.Application");//应该是这一句报错
}
catch(...)
{
ShowMessage("Error...");
}

//使PowerPoint 界面可视
vPowerPoint.OlePropertySet("Visible",true);

//打开一个剪切
//String strPptFile = "C:\\Documents and Settings\\Administrator\\桌面\\C++\\ppt\\zhongkang.ppt";//PPT文件路径and文件名
//String strPptFile = "..\\zhongkang.ppt";//PPT文件路径and文件名
String strPptFile = pDBConfig->GetIniFieldValue("FilePath");//PPT文件路径and文件名
vPowerPoint.OlePropertyGet("Presentations").OleFunction("Open",strPptFile.c_str(),false,false,true);

//放映这个剪切
vPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run");
Application->Terminate();
}
//---------------------------------------------------------------------------
...全文
955 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
缘中人 2011-07-04
  • 打赏
  • 举报
回复
我试了前边都正常,下面这个出问题了
//放映这个剪切
vPowerPoint.OlePropertyGet("ActivePresentation").OlePropertyGet("SlideShowSettings").OleFunction("Run");
  • 打赏
  • 举报
回复
这个错误通常是由于COM在参数类型自动绑定的时候出问题了。
手边没有BCB,哈 你代码一共也没有几行,尝试逐行注释,找出问题。
另外 善用搜索 ,论坛这么些年了 碰到这个问题的人多了。。。嘿嘿
楚天舒1 2011-07-04
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 ksrsoft 的回复:]
是不是版本office不一致
[/Quote]

恭喜你答对了!
缘中人 2011-07-04
  • 打赏
  • 举报
回复
是不是版本office不一致
楚天舒1 2011-07-04
  • 打赏
  • 举报
回复
本地跑都没有问题,只是编译成EXE后到其他的机器上运行就提示错误!
  • 打赏
  • 举报
回复
那就点断,拆开看哪里出问题啊。
Variant AP = vPowerPoint.OlePropertyGet("ActivePresentation");

AP.OlePropertyGet("SlideShowSettings").OleFunction("Run");
不过搜了一下 大家都连着写的 嘿嘿。到底哪里有问题呢?..哥现在没有CB玩了 。。。

13,874

社区成员

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

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