Exception in the synonyms dictionnary of word


2004-02-28 06:09:41 PM
delphi57
Try the following console program :
program ListeMots;
{$APPTYPE CONSOLE}
uses
SysUtils,
ActiveX,
ComObj,
Word2000,
Classes,
Variants;
var
ALanguages:Languages;
WordApplication:_Application;
LanguageID,
LanguageName:OleVariant;
CurrentLanguage:Language;
ASynonymInfo:SynonymInfo;
TempIndex,
MeaningText,
SynonymList:OleVariant;
LocalIndex,
LocalIndex2:Integer;
begin
CoInitialize(nil);
WordApplication:=CoWordApplication.Create;
ALanguages:=WordApplication.Languages;
LanguageName:='english';
CurrentLanguage:=ALanguages.Item(LanguageName);
LanguageID:=CurrentLanguage.Get_ID;
ASynonymInfo:=WordApplication.SynonymInfo['test',LanguageID];
/// <---- HERE
if (ASynonymInfo<>nil) then
for LocalIndex:=VarArrayLowBound(ASynonymInfo.MeaningList,1) to
VarArrayHighBound(ASynonymInfo.MeaningList,1) do
begin
TempIndex:=LocalIndex;
MeaningText:=ASynonymInfo.Get_MeaningList[TempIndex];
WriteLn('Meaning : ' + MeaningText);
SynonymList:=ASynonymInfo.SynonymList[MeaningText];
for LocalIndex2:=VarArrayLowBound(SynonymList,1) to
VarArrayHighBound(SynonymList,1) do
WriteLn(SynonymList[LocalIndex2]);
end;
CoFreeAllLibraries;
end.
I have an exception in the marked line if I thy to search the synonyms of
'despair' and some other words. I don't know if it due to word. I use Office
XP professionnal french. I reinstalled it two time but I always get the same
exception : 'Not enough memory.....'. I have about 200MB free in RAM and 2GB
free in HDD. Can anyone help me ?
TIA,
Florent