在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);
}