_TITLE and extended ASCII characters.
#19
And this gives you the o with the accent:
Notice, I've changed SetWindowTextW to SetWindowTextA

Code: (Select All)
Declare Dynamic Library "user32"
    Sub SetWindowTextA (ByVal Handle As _Offset, title$)
End Declare

Do: Loop Until _WindowHandle

SetWindowTextA _WindowHandle, Chr$((240)) + " Foo"

$If UNICODETOANSI = UNDEFINED Then
    $Let UNICODETOANSI = DEFINED
    Declare CustomType Library
        Function WideCharToMultiByte& (ByVal CodePage As _Unsigned Long, Byval dwFlags As Long, Byval lpWideCharStr As _Offset, Byval cchWideChar As Integer, Byval lpMultiByteStr As _Offset, Byval cbMultiByte As Integer, Byval lpDefaultChar As _Offset, Byval lpUsedDefaultChar As _Offset)
        Function MultiByteToWideChar& (ByVal CodePage As _Unsigned Long, Byval dwFlags As Long, Byval lpMultiByteStr As _Offset, Byval cbMultiByte As Integer, Byval lpWideCharStr As _Offset, Byval cchWideChar As Integer)
    End Declare

    Function UnicodeToANSI$ (buffer As String)
        Dim As String ansibuffer: ansibuffer = Space$(Len(buffer))
        Dim As Long a: a = WideCharToMultiByte(437, 0, _Offset(buffer), Len(buffer), _Offset(ansibuffer), Len(ansibuffer), 0, 0)
        UnicodeToANSI = Mid$(ansibuffer, 1, InStr(ansibuffer, Chr$(0)) - 1)
    End Function

    Sub UnicodeToANSI (buffer As String, __dest As String)
        Dim As String ansibuffer: ansibuffer = Space$(Len(buffer))
        Dim As Long a: a = WideCharToMultiByte(437, 0, _Offset(buffer), Len(buffer), _Offset(ansibuffer), Len(ansibuffer), 0, 0)
        __dest = Mid$(ansibuffer, 1, InStr(ansibuffer, Chr$(0)) - 1)
    End Sub

    Function ANSIToUnicode$ (buffer As String)
        Dim As String unicodebuffer: unicodebuffer = Space$(Len(buffer) * 2)
        Dim As Long a: a = MultiByteToWideChar(65001, 0, _Offset(buffer), Len(buffer), _Offset(unicodebuffer), Len(unicodebuffer))
        ANSIToUnicode = unicodebuffer
    End Function

    Sub ANSIToUnicode (buffer As String, __dest As String)
        Dim As String unicodebuffer: unicodebuffer = Space$(Len(buffer) * 2)
        Dim As Long a: a = MultiByteToWideChar(65001, 0, _Offset(buffer), Len(buffer), _Offset(unicodebuffer), Len(unicodebuffer))
        __dest = unicodebuffer
    End Sub
$End If
Ask me about Windows API and maybe some Linux stuff
Reply


Messages In This Thread
_TITLE and extended ASCII characters. - by Pete - 11-15-2022, 04:25 PM
RE: _TITLE and extended ASCII characters. - by SpriggsySpriggs - 11-15-2022, 08:36 PM



Users browsing this thread: 2 Guest(s)