程序如下 ::CoInitialize(NULL);
_Application objWord;
// Convenient values declared as ColeVariants.
COleVariant covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
// Get the IDispatch pointer and attach it to the objWord object.
if (!objWord.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't get Word object.");
return;
}
结果总是返回Couldn't get Word object。请问都有哪些情况会导致CreateDispatch失败。(word已安装)
_Application objWord;
// Convenient values declared as ColeVariants.
COleVariant covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
// Get the IDispatch pointer and attach it to the objWord object.
if (!objWord.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't get Word object.");
return;
}
结果总是返回Couldn't get Word object。请问都有哪些情况会导致CreateDispatch失败。(word已安装)
解决方案 »
- 散分+牢骚
- 奇怪的fwrite问题
- 這段程式該怎麼解釋明白呢?
- VC6:CGridListCtrl里面放个下拉列表,下拉列表里有若干的值。现在我想手动指定该下拉列表的值。但是有时能显示,有时不行。高手指点~
- 如何随心所欲地利用VC来调试
- dll中有个对话框有用到Timer,但必须DoModel才能用,但我不想让这个框弹出,怎么办?
- 如何改变disabled的edit框的字体颜色?
- 在c++中堆和栈是不是一样的东西??
- 请问:什么地方有英文版本的SP5下载?我实在是找不到了
- 怎样在代码中创建一个EXE文件?如:指定一个位图创建一个DIALOG让它显示这个位图?
- 滚动视图,用什么函数。我忘拉。SetWindowScroll()吗。在线
- 测试结果:我的WaitForMultipleObjects函数好象没有返回什么东西
我的word装在c盘,系统装在d盘有影响吗