ui/winui/util.cpp

Sun, 01 Oct 2023 16:39:03 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 01 Oct 2023 16:39:03 +0200
branch
newapi
changeset 189
4daddc326877
parent 180
f34953bf4ac7
child 192
bcacd00ea955
permissions
-rw-r--r--

add onchange event for toggle buttons (WinUI3)



#include "util.h"

#include <stdlib.h>

#include <Windows.h>


wchar_t* str2wstr(const char* str, int* newlen) {
    size_t len = strlen(str);


    wchar_t* wstr = (wchar_t*)calloc(len + 1, sizeof(wchar_t));
    int wlen = MultiByteToWideChar(
        CP_UTF8,
        0,
        str,
        len,
        wstr,
        len + 1
    );
    if (newlen) {
        *newlen = wlen;
    }
    wstr[wlen] = 0;

    return wstr;
}

mercurial