Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_TITLE and extended ASCII characters.
#13
@Spriggsy

Nope. It throws a question mark in the title bar. Also the " Foo" won't show without special formatting. See below, but we still can't get the unicode chr$(240) to print.

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

DO: LOOP UNTIL _WINDOWHANDLE

result = SetWindowTextW(_WINDOWHANDLE, ANSIToUnicode(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:17 PM



Users browsing this thread: 18 Guest(s)