[Lazarus] String vs WideString

Juha Manninen juha.manninen62 at gmail.com
Wed Aug 16 17:38:15 CEST 2017


On Wed, Aug 16, 2017 at 5:48 PM, Marcos Douglas B. Santos via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> I cannot say from others, but I had this issue (about WideString) for now.

The section "Calling Windows API" says:
 'Only the "W" versions of Windows API functions should be called. It
is like in Delphi except that you must assign strings to/from API
calls to UnicodeString variables or typecast with UnicodeString().'
Then it also explains the difference between WideString and UnicodeString.
I should add a mention about PWideChar parameters.
Anyway the idea is to keep the information useful and dense. Earlier
it was bloated and intimidating.

> Are you saying that I need to do this?
> (following the firt example on this thread)

No, if the parameter is WideString, not a pointer PWideChar, you can
just call it like you did. Suppress the warning as Mattias told if it
bothers you. You can also make a helper function so the conversion
happens in one place.
Yes, for OLE you need WideString.

Juha


More information about the Lazarus mailing list