Hi.
I have problems to get the correct utf-filename of files, dropped to may window.
I am using DragQueryFileA to get the filenames, that are dropped to my window. It is implemented like this:
function ulong DragQueryFileA( ulong ul_Drop, ulong ul_index, ref string LPTSTR, ulong cb ) LIBRARY "shell32.dll" alias for "DragQueryFileA;Ansi"
In that implementation, DragQueryFileA provides the Ansi-names.
But I have filenames with german special characters like this "C:\temp\MeinMülleimer.png" dropped.
The name provided by DragQueryFileA then is "C:\temp\MeinMu¨lleimer.png".
If already remove the "...;Ansi" in the external function.
Then I get a string like this "㩃瑜浥屰敍湩畍沨敬浩牥瀮杮" (think it's 3-byte-characters).
I have written a small function to convert the value:
string ls_filename
ls_filename = string( blob(as_filename, EncodingUTF16LE! ), encodingUTF8! )
This returns ls_filename like that: "C:\temp\MeinMu¿lleimer.png", which also is not the correct name.
How do I get the correct name of the dropped file?
Thank you for that quick answer, Mike.
Regards
Rolf
Including ALIAS FOR ";xxxxxx;ansi" in the PowerBuilder external function declaration tells PowerBuilder to perform the encoding translation between Unicode (what PB uses) and ANSI (what the ANSI-flavor of the API function uses). Both Windows and PB use Unicode 16LE encoding internally, Windows provides ANSI-encoded versions of its API functions for legacy compatibility.