WinAPI 设置左上角图标和TAB图标

在WM_CREATE消息, 添加如下代码

HINSTANCE hInstance = ::GetModuleHandle(NULL);
HICON hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SMALL));
if (hIcon)
{
    ::SendMessage(GetHWND(), WM_SETICON, ICON_BIG, (LPARAM)hIcon);
    ::SendMessage(GetHWND(), WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
}

留下评论