Is this code in a DLL ? If so then you can not transfer ansistrings unless you use a sharememory kludge.
Last time I chose to use shortstrings to get around this. That worked fine except in some instances on some PCs, the exceptions would not work... When I thought about it, the exception object itself uses ansistring. So Borlands staement is not true.... if the DLL can possible raise an exception, it uses ansistring and you need to use sharemem. Date sent: Tue, 18 Jul 2006 11:13:50 +1200 From: Phil Middlemiss <[EMAIL PROTECTED]> Organization: MTS Ltd To: NZ Borland Developers Group - Delphi List <[email protected]> Subject: [DUG] Returning a WideString in an Invoke Param Send reply to: NZ Borland Developers Group - Delphi List <[email protected]> <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]> 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. Regards Rohit ====================================================================== CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH (649) 489-2280 FX (649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] ====================================================================== _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
