Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13456 > unrolled thread

string

Started byaurora baccio <aurorabaccio@gmail.com>
First post2021-10-18 06:52 -0700
Last post2021-10-19 16:11 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  string aurora baccio <aurorabaccio@gmail.com> - 2021-10-18 06:52 -0700
    Re: string "Wolfgang Riedmann" <wriedmann@gmail.com> - 2021-10-19 09:09 +0200
      Re: string aurora baccio <aurorabaccio@gmail.com> - 2021-10-19 09:48 -0700
    Re: string "Karl-Heinz" <invalid@invalid.invalid> - 2021-10-19 16:11 +0200

#13456 — string

Fromaurora baccio <aurorabaccio@gmail.com>
Date2021-10-18 06:52 -0700
Subjectstring
Message-ID<29a74e7b-80b2-4dd6-ae3c-8708e0a30403n@googlegroups.com>
good morning.
unknown grammar
My habit in creating string variables is as follows :
local cVariable := "" as string 
You always propose me instead of string string2psz.
I would like to know the difference and the usefulness in using one or the other. 
If I search in the help I don't understand the differences.
thanks
Aurora Baccio

[toc] | [next] | [standalone]


#13457

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2021-10-19 09:09 +0200
Message-ID<it799cFo4ocU1@mid.individual.net>
In reply to#13456
Buon giorno Aurora,

the "normal" variable type to use in VO is "string".

C/C++, the language in which Windows is written, does not knows that
datatype.
In these languages (and some more) a string is defined as a sequence of
bytes terminated by a byte with the value of 0 (zero).
This datatype exists also in VO, and is called "PSZ" - a Pointer to a
String terminated with Zero.

So, if you have to interface with the Windows API you cannot use a
string, but you have to use a PSZ.

The function "String2PSZ()" does exactly what it says:
a memory part is allocated, and string content is copied there, and
terminated with a zero byte. The a pointer to this memory allocation is
returned, and this can be passed to the Windows API call.
If the function/method ends, the memory is released to the OS.

Wolfgang


aurora baccio wrote:

> good morning.
> unknown grammar
> My habit in creating string variables is as follows :
> local cVariable := "" as string 
> You always propose me instead of string string2psz.
> I would like to know the difference and the usefulness in using one
> or the other.  If I search in the help I don't understand the
> differences.  thanks
> Aurora Baccio



-- 

[toc] | [prev] | [next] | [standalone]


#13460

Fromaurora baccio <aurorabaccio@gmail.com>
Date2021-10-19 09:48 -0700
Message-ID<414492f5-940d-4e79-8b42-882c215977d4n@googlegroups.com>
In reply to#13457
Il giorno martedì 19 ottobre 2021 alle 09:09:35 UTC+2 Wolfgang Riedmann ha scritto:
> Buon giorno Aurora, 
> 
> the "normal" variable type to use in VO is "string". 
> 
> C/C++, the language in which Windows is written, does not knows that 
> datatype. 
> In these languages (and some more) a string is defined as a sequence of 
> bytes terminated by a byte with the value of 0 (zero). 
> This datatype exists also in VO, and is called "PSZ" - a Pointer to a 
> String terminated with Zero. 
> 
> So, if you have to interface with the Windows API you cannot use a 
> string, but you have to use a PSZ. 
> 
> The function "String2PSZ()" does exactly what it says: 
> a memory part is allocated, and string content is copied there, and 
> terminated with a zero byte. The a pointer to this memory allocation is 
> returned, and this can be passed to the Windows API call. 
> If the function/method ends, the memory is released to the OS. 
> 
> Wolfgang
> aurora baccio wrote: 
> 
> > good morning. 
> > unknown grammar 
> > My habit in creating string variables is as follows : 
> > local cVariable := "" as string 
> > You always propose me instead of string string2psz. 
> > I would like to know the difference and the usefulness in using one 
> > or the other. If I search in the help I don't understand the 
> > differences. thanks 
> > Aurora Baccio
> --
thanks

[toc] | [prev] | [next] | [standalone]


#13458

From"Karl-Heinz" <invalid@invalid.invalid>
Date2021-10-19 16:11 +0200
Message-ID<it827iFsoukU2@mid.individual.net>
In reply to#13456
Hi Aurora,

in addition to what Wolfgang wrote:  I´m using 2.8 SP3 where some VO
functions use a PSZ instead of a STRING declaration.

e.g.

_DLL FUNCTION DirMake (pszDir  AS PSZ) AS INT PASCAL:VO28RUN.DirMake


To make the compiler happy you should use String2Psz() in such cases.

DirMake ( String2Psz ( cDirName) )

regards
Karl-Heinz

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web