🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.csharpbuilder.com-interop
1 messages
1 total messages Started by argami Thu, 05 Oct 2006 17:11
Problem with OleVariant and C#
#4
Author: argami
Date: Thu, 05 Oct 2006 17:11
34 lines
1856 bytes
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?????
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads