_TITLE and extended ASCII characters.
#11
@Spriggsy

Must be doing something wrong here. Letters print, but no CHR$(240)

Code: (Select All)
DECLARE DYNAMIC LIBRARY "user32"
    FUNCTION SetWindowTextW (BYVAL Handle AS _OFFSET, title$)
END DECLARE
_DELAY .2

result = SetWindowTextW(_WINDOWHANDLE, UnicodeToANSI$(CHR$(240)) + " " + CHR$(0) + "F" + CHR$(0) + "o" + CHR$(0) + "o" + CHR$(0) + CHR$(0))

$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

Pete
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 Pete - 11-15-2022, 08:01 PM



Users browsing this thread: 24 Guest(s)