A
age
Unregistered / Unconfirmed
GUEST, unregistred user!
请看以下代码:
var
_word: Olevariant;
document: IUnknown;
dataObject: IDataObject;
info: TCreateInfo;
begin
_word := createOleObject( 'Word.Application' );
_word.visible:=true;
//no. 1
document := _word.documents.open( 'e:/t.doc' );
//no. 2
//document := _word.documents.add ;
document:=_word.activedocument;
dataobject:=document as IdataObject;
ZeroMemory (@info, SizeOf (TCreateInfo));
info.createType := ctFromData;
info.showAsIcon := false;
info.iconMetaPict := 0;
info.dataObject := dataObject;
oleContainer1.createObjectFromInfo( info );
_word.quit;
end;
问题是:采用no.1程序正常运行,采用no.2程序执行到oleContainer1.createObjectFromInfo( info )时出错“服务器出现意外情况”而此时的WORD已经正常打开。
请各路人马帮助。谢。
var
_word: Olevariant;
document: IUnknown;
dataObject: IDataObject;
info: TCreateInfo;
begin
_word := createOleObject( 'Word.Application' );
_word.visible:=true;
//no. 1
document := _word.documents.open( 'e:/t.doc' );
//no. 2
//document := _word.documents.add ;
document:=_word.activedocument;
dataobject:=document as IdataObject;
ZeroMemory (@info, SizeOf (TCreateInfo));
info.createType := ctFromData;
info.showAsIcon := false;
info.iconMetaPict := 0;
info.dataObject := dataObject;
oleContainer1.createObjectFromInfo( info );
_word.quit;
end;
问题是:采用no.1程序正常运行,采用no.2程序执行到oleContainer1.createObjectFromInfo( info )时出错“服务器出现意外情况”而此时的WORD已经正常打开。
请各路人马帮助。谢。