C++Builder 程序员博客
3 Dec
在网上找的代码,可是一运行就出错,哪位高人能指点下,这段代码哪里出错了?谢谢~!!
void TMainFrm::Speech(String sText)
{
//TODO: Add your source code here
if(sText.Trim()=="")
return;
Variant excel_app;
try
{
excel_app=Variant::CreateObject("excel.application"); //创建app对象
excel_app.OlePropertySet("Visible",(Variant)false); //可见
}
catch (Exception &exception)
{
//Application->MessageBox("调用EXCEL失败!可能你的电脑里没有EXCEL!!","提示信息",MB_OK);
return;
}
Function Speak("Speak");
//excel_app.OlePropertyGet("Application").OlePropertyGet("Speech").Exec(Speak < < ed->Text);
excel_app.OlePropertyGet("Speech").Exec(Speak < < sText); //运行到这里就出错了????
//Application->MessageBoxA("朗读已经完成","提示信息",MB_OK);
excel_app.OleFunction("Quit");
excel_app.Clear();
}
/* 把 sText改成 sText.c_str() 试试 */
也是不行,在哪里能查到speak的用法呢,谢谢!!!
// 需要自己录制宏,然后写代码 // 俺的Office没有安装那个文本到语音的组件,所以不能测试 // excel_app.OlePropertyGet("Speech").OleFunction("Speak","helloworld") 这样看有没有问题