[DUG] Returning a WideString in an Invoke Param

Phil Middlemiss phil at tumonz.co.nz
Tue Jul 18 11:13:50 NZST 2006


Hi all,

I have an automation object with events. One of the events has a couple 
of VAR parameters which I'm not quite sure how to handle. Here is the 
code that is NOT working:

procedure TT3SDKEvents.DoInvoke(Sender : TObject; DispID: Integer; const 
IID: TGUID;
  LocaleID: Integer; Flags: Word; var Params: TDispParams; VarResult, 
ExcepInfo,
  ArgErr: Pointer);
    case DispID of

    ...

    4: { OnIdentify }
      if assigned(FOnIdentify) then
        begin
        //initialise the values
        layermanagerid :=  WideCharToString(Params.rgvarg[1].bStrVal);
        appname := WideCharToString(Params.rgvarg[0].bstrVal);
        if assigned(FOnIdentify) then
          FOnIdentify(layermanagerid, appname);
        Params.rgvarg[1].bstrVal := PWideChar(layermanagerid);
        Params.rgvarg[0].bstrVal := PWideChar(appname);
        end;
    end;
end;

The above code just ends up returning an empty string - I've checked to 
make sure that the call to FOnIdentify is indeed returning values.
So the question is: how should I be returning a widestring in the 
TDispParams?

Cheers,
Phil.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phil.vcf
Type: text/x-vcard
Size: 250 bytes
Desc: not available
Url : http://ns3.123.co.nz/pipermail/delphi/attachments/20060718/4a9c04c1/phil.vcf


More information about the Delphi mailing list