X10 Community Forum

🖥️ActiveHome Pro => SDK => Topic started by: JDB on December 22, 2007, 09:33:39 AM

Title: SDK & delphi 7 RecvAction error
Post by: JDB on December 22, 2007, 09:33:39 AM
I just down loaded the sdk installed it in delphi 7.   I can send commands fine, but when I try to use the RecvAction I get and "Invalid variant Type".  Can anybody help me.   I saw some old Post out here about some people having problems but those were 2 years ago?

Thanks  Jerry
Title: Re: SDK & delphi 7 RecvAction error
Post by: ddv2005 on January 04, 2008, 10:30:15 PM
It is Delphi problem (all version from 5 to latest). Delphi generate all parameters of RecvAction event as Olevariant but TOleControl.InvokeEvent resolve all params from OleVariant to actual type and application failed on locking OleVariant parameters because it is NOT olevariant. More that, last parameter is datetime and some time it is null and TOleControl.InvokeEvent resolve it to integer (4 bytes). But when last parameter is actual datetime then TOleControl.InvokeEvent resolve it to 8 bytes!!! but RecvAction event expect only 4!!! bytes and it is SHIFT ALL PARAMETERS!!!! It is crazy but it is DELPHI CODE in ALL VERSIONS! I resolve this problem by overriding TOleControl.InvokeEvent in generated TLB code as

procedure TActiveHome.InvokeEvent(DispID: TDispID; var Params: TDispParams);
begin
  if Params.cArgs=7 then
    if Assigned(FOnRecvAction) then
      FOnRecvAction(Self,OleVariant(Params.rgvarg[6]),OleVariant(Params.rgvarg[5]),
      OleVariant(Params.rgvarg[4]),OleVariant(Params.rgvarg[3]),
      OleVariant(Params.rgvarg[2]),OleVariant(Params.rgvarg[1]),
      OleVariant(Params.rgvarg[1]));
end;
Title: Re: SDK & delphi 7 RecvAction error
Post by: rordonez on February 26, 2008, 11:00:02 PM
Where on the TLB Code do you paste this code to Override the invokeEvent Function?

what kind of declaration does the override need.



Title: Re: SDK & delphi 7 RecvAction error
Post by: disappear on January 12, 2009, 05:53:26 AM
Can u Resolved this problem ? i have this problem . when i use the RecvAction my application is locked .