> > > if so can you then just pass PChar(S) to your function rather
> > > than using an
> > > intermediary
> > > variable...
> >
> > Yeah that's right, just use FindWindow (PChar(SomeString) ...
>
> What about
>
> var T: PChar;
> [...]
>
> T:=PChar(SomeString);
>
> FindWindow(PChar(S),T);
That's just the same ...
> > > 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;
> >
> > S after the Trim becomes a Nil reference because Trim returns a Nil
> > reference and the original space string has been
> deallocated (reference
> > count = 0).
>
> The compiler would disagree
Have you tried that out?
> FindWindow(PChar(S),PChar(T)) where T='' does NOT work
>
> IMO PChar('') returns a pointer to a string consisting of a
> null character
> (not the same as a nil pointer)
Note that T := '' (which is the same as T := PChar('')) is *NOT* the same as
T := Nil, or
var
s: string;
T: PChar;
begin
s := '';
T := PChar(s);
Can you see the difference?
Regards,
Dennis.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz