P
pepper
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure THTMLEdit.GetStyles;
var
varRange : OleVariant;
b : TBStr;
a : PSafeArray;
l, h, i : longint;
hr : HRESULT;
str:string;
begin
TVariantArg(VarRange).VT := VT_ARRAY
// VarArray or VarOleStr;
TVariantArg(VarRange).ppArray := nil;
hr := HrExecCommand(IDM_GETBLOCKFMTS, NilVariant, VarRange, false, false);
if (hr = 0) then begin
i := VarArrayDimCount(varRange);
l := VarArrayLowBound(VarRange, i);
h := VarArrayHighBound(VarRange, i);
a := TVariantArg(VarRange).pArray;
for i := l to h do begin
SafeArrayGetElement(a, i, b);
FStyles.Add(OleStrTostring(b));
end;
end;
delphi7 下
SafeArrayGetElement(a, i, b);运行到该句时出现Invalid variant type的错误!!
找到该function的源码:
function SafeArrayGetElement(psa: PSafeArray
const rgIndices
out pv): HResult
stdcall;
{$EXTERNALSYM SafeArrayPutElement}
请问:哪里出错?????
var
varRange : OleVariant;
b : TBStr;
a : PSafeArray;
l, h, i : longint;
hr : HRESULT;
str:string;
begin
TVariantArg(VarRange).VT := VT_ARRAY
// VarArray or VarOleStr;
TVariantArg(VarRange).ppArray := nil;
hr := HrExecCommand(IDM_GETBLOCKFMTS, NilVariant, VarRange, false, false);
if (hr = 0) then begin
i := VarArrayDimCount(varRange);
l := VarArrayLowBound(VarRange, i);
h := VarArrayHighBound(VarRange, i);
a := TVariantArg(VarRange).pArray;
for i := l to h do begin
SafeArrayGetElement(a, i, b);
FStyles.Add(OleStrTostring(b));
end;
end;
delphi7 下
SafeArrayGetElement(a, i, b);运行到该句时出现Invalid variant type的错误!!
找到该function的源码:
function SafeArrayGetElement(psa: PSafeArray
const rgIndices
out pv): HResult
stdcall;
{$EXTERNALSYM SafeArrayPutElement}
请问:哪里出错?????