Problem with OleVariant and C#

  • Thread starter Thread starter argami
  • Start date Start date
A

argami

I have a com delphi exe, with this code:

TMyRecord = Record
a:Integer;
end;

function RecordToVariant(r: TMyRecord):OleVariant;
var
P:Pointer;
begin
result :=VarArrayCreate([0, sizeof(TMyRecord)], varByte);

P := VarArrayLock(result);
Move(P^, result, sizeof(r));
VarArrayUnlock(result);
end;

so i use this code in 1 function like

procedure SomeFunction(var v:OleVariant);
var
myRecord:TMyRecord;
begin
myRecord.a := 1;
v := RecordToVariant(myRecord);
end;

Ok my problem is i can't change this code. In my c# consuming client
I've to use SomeFunction geting this olevariant like object but i dont
know how to extract this record to another c# struct with the same
members.

Anybody can help me?????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top