1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-31 20:05:29 +01:00

Proper Unicode support for drop down text in GUI

This commit is contained in:
Valentin Radu 2021-10-25 05:42:24 +03:00
parent 0210935459
commit 68f32441fb

View File

@ -719,21 +719,33 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
p = strchr(p + 1, '\n');
if (p) *p = 0;
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
wchar_t* miText = malloc((strlen(ln) + 1) * sizeof(wchar_t));
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
ln,
strlen(ln) + 1,
miText,
strlen(ln) + 1
);
MENUITEMINFOW menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));
menuInfo.cbSize = sizeof(MENUITEMINFOW);
menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;
menuInfo.wID = atoi(l + 3) + 1;
menuInfo.dwItemData = l;
menuInfo.fType = MFT_STRING;
menuInfo.dwTypeData = ln;
menuInfo.dwTypeData = miText;
menuInfo.cch = strlen(ln);
InsertMenuItemA(
InsertMenuItemW(
hMenu,
i,
TRUE,
&menuInfo
);
free(miText);
}
}
numChRd = getline(&line, &bufsiz, f);