mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
[KBSWITCH] Follow-up of 0991ced
- Used FW_NORMAL. - Added NULL checks. CORE-10667
This commit is contained in:
parent
c7ba53e3fb
commit
261416ddb9
|
@ -169,13 +169,31 @@ CreateTrayIcon(LPTSTR szLCID)
|
||||||
hdc = CreateCompatibleDC(NULL);
|
hdc = CreateCompatibleDC(NULL);
|
||||||
hbmColor = CreateCompatibleBitmap(hdc, CX_ICON, CY_ICON);
|
hbmColor = CreateCompatibleBitmap(hdc, CX_ICON, CY_ICON);
|
||||||
hbmMono = CreateBitmap(CX_ICON, CY_ICON, 1, 1, NULL);
|
hbmMono = CreateBitmap(CX_ICON, CY_ICON, 1, 1, NULL);
|
||||||
|
if (!hdc || !hbmColor || !hbmMono)
|
||||||
|
{
|
||||||
|
if (hdc)
|
||||||
|
DeleteDC(hdc);
|
||||||
|
if (hbmColor)
|
||||||
|
DeleteObject(hbmColor);
|
||||||
|
if (hbmMono)
|
||||||
|
DeleteObject(hbmMono);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a font */
|
/* Create a font */
|
||||||
ZeroMemory(&lf, sizeof(lf));
|
ZeroMemory(&lf, sizeof(lf));
|
||||||
lf.lfHeight = -11;
|
lf.lfHeight = -11;
|
||||||
lf.lfCharSet = ANSI_CHARSET;
|
lf.lfCharSet = ANSI_CHARSET;
|
||||||
|
lf.lfWeight = FW_NORMAL;
|
||||||
StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), _T("Tahoma"));
|
StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), _T("Tahoma"));
|
||||||
hFont = CreateFontIndirect(&lf);
|
hFont = CreateFontIndirect(&lf);
|
||||||
|
if (!hFont)
|
||||||
|
{
|
||||||
|
DeleteDC(hdc);
|
||||||
|
DeleteObject(hbmColor);
|
||||||
|
DeleteObject(hbmMono);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SetRect(&rect, 0, 0, CX_ICON, CY_ICON);
|
SetRect(&rect, 0, 0, CX_ICON, CY_ICON);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue