图标问题!请大虾捧场
一个基于对话框的MFC程序,想让左上角的图标动起来,下列代码有何问题(动不起来):
void CClientDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
static int roll=1;
HICON hIcon;
int rand=roll%4;
if(rand==0)
hIcon=AfxGetApp()->LoadIcon(IDI_UPICON);
else if(rand==1)
hIcon=AfxGetApp()->LoadIcon(IDI_RIGHTICON);
else if(rand==2)
hIcon=AfxGetApp()->LoadIcon(IDI_DOWNICON);
else if(rand==3)
hIcon=AfxGetApp()->LoadIcon(IDI_LEFTICON);
ASSERT(hIcon);
SetClassLong(this->GetSafeHwnd(),GCL_HICON,(LPARAM)hIcon);
//用WM_SETICON也不行
//this->SendMessage(WM_SETICON,TRUE,(LPARAM)hIcon);
roll++;
CDialog::OnTimer(nIDEvent);
}