> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Aaron Scott-Boddendijk
> Sent: Friday, 21 January 2000 23:31
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Invalid pointer operation
snip

> Question though (as I've not tested it in delphi)... Doesn't an
> empty string
> simply mean
> that the string reference is nil...
> EG
> var
>   S :String;
> begin
>   S := ' ';  // S is not nil but a reference a string containing a space
>   S := Trim(S); // Does S now point to a string of length 0 or does it
> contain nil?
> end;
>
> if so can you then just pass PChar(S) to your function rather
> than using an
> intermediary
> variable...

Doesn't work like that, no.

If you followed the discussions on FindWindow over the past few days, the
last message I posted was to the effect that PChar('') didn't work.

In one case you are passing an actual null pointer, in the other case you
are passing a pointer to a null terminated zero length string. They are
different. Still, I guess I can dispense with the GetMem and FreeMem and
just set my PChar variable directly from a typecast. These modern compilers
make things easier for you - I was brought up on New and Dispose, old habits
die hard :)

============================================
Patrick Dunford, Christchurch, NZ
EnzedRailWeb Sites
http://patrick.dunford.com/enzedrailweb/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to