Invalid Variant Operation Exception Trying to Access OleVariant in Delphi - Works in C# -


I am trying to access an universal callback that is coming from an ActiveX library.

The event handler is defined as TLB:

  process (AS & T: TBYX; var structureQNAP: {? StrictVTQNAP} wet variant); Here is the definition of structVTIQSnap in TLB:  
  structVTIQSnap = pack records bstrSymbol: WideString; BstrListingExch: Widestring; BstrLastExch: WideString; FLastPrice: Double; NLastSize: integer; BstrBbo: Widestring; BstrBidExch: WideString; FBIDPrice: Double; NBidSize: Integer; BstrAskExch: Widestring; FAskPrice: Double; NAskSize: integer; FHighPrice: Double; Fallpreet: Double; FOpenPrice: Double; FClosePrice: Double; NCumVolume: integer; BstrTradeCondition: Widestring; NQuoteCondition: Integer; BstrCompanyName: Widestring; F52WeekHigh: Double; F52WeekLow: Double; FPS: Double; NSharesOutstanding: integer; NSpCode: integer; FB eta: Double; BstrExDivDate: WideString; NDivFreq: Integer; FDivAmt: Double; Navigolum: integer; Bstr Cookie: Widestring; Fwap: double; BstrUpdateTime: WideString; BstrExch: WideString; NSharesPerContract: Integer; End; It compiles ok, but every time I try to reach bstrSymbol, I get an "invalid type of operation":  
  process TForm1.HandleVTIQuoteSnap (Acedor: Tuboject; var StructureCaps: Oliverient); Var Symbol: Widestring; Start symbol: = structQSnap.bstrSymbol; // This line exception causes the end;  

How do I use the QSnap structure and its properties in Delphi?

In C #, this function works fine for event handlers:

  Void vtiQ_OnVTIQSnap (referee vtiLib.structVTIQSnap structQSnap) {MessageBox.Show (for " Qsnap found + structQuoteSnap.bstrSymbol); }  

Any ideas?

I think Delphi's ActiveX import wizard does not know how to fix structVTIQSnap type ( Which seems to be a record) is okay and only uses default olywant? Is there a type of declaration called structVTIQSnap or generated ... _ TLB.pas file similar? Try using that instead of OleVariant, for example.

  Process (ester: tubet; var structQSnap: structVTIQSnap) of the object;  

The type will probably be declared as a "pack record".


Comments