So help me understand BSTR, as I'm curious about it. José, are you saying that PB's native string type (dynamic string) is BSTR? As near as I can tell BSTR is just a pointer to a bunch of OLECHARs (Essentially WChars). Where is the length stored? Or is it? A brief search and looking at the header files suggests BSTR is very similar to ZString, although with 16-bit wide characters.
In my mind, FB's ZString is not a good option here, especially for file names, unless you use ASCII, UTF-8, or some other byte encoding, which isn't a natural fit on Windows as your PB function would have to decode whatever byte encoding your Zstring used, and re-encode to UTF-16 before calling any Win32 api. In my mind, BSTR is your bettery option here, since it's natively UTF-16 unicode. But you will have to consider how your FB strings (and literal strings) are converted to BSTR and what encoding the conversion function is expecting (ASCII, UTF-8, or something else).
EDIT: removed ansi vs unicode stuff
Last edited by caseih
on Feb 19, 2018 18:49, edited 1 time in total.