mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-22 10:55:19 -04:00
[vhd] fix VHD detection on Windows 7
* Revert to using strstr * Also fix a potential issue with GetTextExtentPoint
This commit is contained in:
parent
8e8a2bc827
commit
efd22d1fe3
4 changed files with 20 additions and 21 deletions
|
@ -867,23 +867,19 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry)
|
|||
HDC hDC;
|
||||
HFONT hFont, hDefFont = NULL;
|
||||
SIZE size;
|
||||
WCHAR* wentry = NULL;
|
||||
int len;
|
||||
|
||||
hDC = GetDC(hDropDown);
|
||||
hFont = (HFONT)SendMessage(hDropDown, WM_GETFONT, 0, 0);
|
||||
if (hFont != NULL)
|
||||
hDefFont = (HFONT)SelectObject(hDC, hFont);
|
||||
|
||||
wentry = utf8_to_wchar(entry);
|
||||
len = (int)wcslen(wentry)+1;
|
||||
GetTextExtentPoint32W(hDC, wentry, len, &size);
|
||||
if (!GetTextExtentPointU(hDC, entry, &size))
|
||||
size.cx = 0;
|
||||
|
||||
if (hFont != NULL)
|
||||
SelectObject(hDC, hDefFont);
|
||||
|
||||
ReleaseDC(hDropDown, hDC);
|
||||
free(wentry);
|
||||
return size.cx;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue