需要实现一种接口方法,在该方法中传递了一个指针,并且期望该方法取消引用该指针并为其分配OleVariant。这样做的语法是什么?
// Code I have no access to change
function GetEntry: string;
var
value: OleVariant;
begin
Entry(@value);
Result := VarToStr(value);
end;
// My code
procedure Entry(Value: Pointer);
begin
Value^ := ??? // Not sure whats the syntax here in order to assign an OleVariant
end
答案 0 :(得分:8)
您可以使用这样的值转换:
OleVariant(Value^) := ...
或者,您可以投射指针:
POleVariant(Value)^ := ...