Thema: Delphi How to - string in DLL

Einzelnen Beitrag anzeigen

Benutzerbild von jaenicke
jaenicke

Registriert seit: 10. Jun 2003
Ort: Berlin
9.379 Beiträge
 
Delphi 11 Alexandria
 
#19

AW: How to - string in DLL

  Alt 20. Jun 2011, 15:53
Also another think: to use Ansii or Unicode I have to write 2 functions with PWideChar and PAnsiChar parameters? Or one lets say Unocode version and second to convert Unicode Buffer to Ansi - how?
Well, for the version with PAnsiChar you append an A, and for PWideChar a W.
For example the API has ShellExecuteA and ShellExecuteW. Delphi itself maps ShellExecute to ShellExecuteA (Delphi 1 - 2007) or to ShellExecuteW (Delphi 2009+). So you don't see that you call one of the other functions.

And WideString - it is always Unicode?
Yes it is.

I myself do not want to use it because it relies on OLE and the operating system. That's why it is much slower. Of course this doesn't matter unless you call such a method often.

For COM WideStrings are very useful (I also used them to interact with .NET libraries with exported native functions), but for other purposes I do not use them.

But it is your decision, both ways work.
Sebastian Jänicke
Alle eigenen Projekte sind eingestellt, ebenso meine Homepage, Downloadlinks usw. im Forum bleiben aktiv!
  Mit Zitat antworten Zitat