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'); p = strchr(p + 1, '\n');
if (p) *p = 0; if (p) *p = 0;
MENUITEMINFOA menuInfo; wchar_t* miText = malloc((strlen(ln) + 1) * sizeof(wchar_t));
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA)); MultiByteToWideChar(
menuInfo.cbSize = sizeof(MENUITEMINFOA); 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.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;
menuInfo.wID = atoi(l + 3) + 1; menuInfo.wID = atoi(l + 3) + 1;
menuInfo.dwItemData = l; menuInfo.dwItemData = l;
menuInfo.fType = MFT_STRING; menuInfo.fType = MFT_STRING;
menuInfo.dwTypeData = ln; menuInfo.dwTypeData = miText;
menuInfo.cch = strlen(ln); menuInfo.cch = strlen(ln);
InsertMenuItemA( InsertMenuItemW(
hMenu, hMenu,
i, i,
TRUE, TRUE,
&menuInfo &menuInfo
); );
free(miText);
} }
} }
numChRd = getline(&line, &bufsiz, f); numChRd = getline(&line, &bufsiz, f);