I've spent about 2 hours scouring all the posts dealing with Unicode, Unicode2Ansi(), etc.
All I want to do is display some Greek characters in a message box and Gui
Seems like there have been may requests for this seeminly simple funciton, but no easy answers.
Here's my best attempt:
Code:
wString := "α" ; greek text to be displayed in message box or GUI
DisplayText := Unicode2Ansi(wString, sString) ; sString *SHOULD* (I asssume?) be the output (return) value form the funtion
; Greate Gui
Gui, Add, Text, +Center vDisplayText, Text
GuiControl,, DisplayText, %DisplayText% ; display α character in GUI
Gui, Show, x800 y300 h50 w100, New GUI Window
Msgbox, Unicode Text: %DisplayText% ; display α character in Msgbox.
Return
Unicode2Ansi(ByRef wString, ByRef sString, CP = 0) ; Code lifted fom the Unicode2Ansi conversion posts
{
nSize := DllCall("WideCharToMultiByte"
, "Uint", CP
, "Uint", 0
, "Uint", &wString
, "int", -1
, "Uint", 0
, "int", 0
, "Uint", 0
, "Uint", 0)
VarSetCapacity(sString, nSize)
DllCall("WideCharToMultiByte"
, "Uint", CP
, "Uint", 0
, "Uint", &wString
, "int", -1
, "str", sString
, "int", nSize
, "Uint", 0
, "Uint", 0)
}