在CMainFrame::PreCreateWindow 中加入如下:
WNDCLASS wndcls;
::GetClassInfo(AfxGetInstanceHandle(),cs.lpszClass,&wndcls);
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CURSOR1));
::AfxRegisterClass(&wndcls);
为什么不能成功,呀!
AFXGETAPP->LAODCURSOR(IDC—CURSOR)也不行呀?
WNDCLASS wndcls;
::GetClassInfo(AfxGetInstanceHandle(),cs.lpszClass,&wndcls);
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CURSOR1));
::AfxRegisterClass(&wndcls);
为什么不能成功,呀!
AFXGETAPP->LAODCURSOR(IDC—CURSOR)也不行呀?
SetIcon(hIcon,true);
IDR_FORMTYPE
自定义的光标资源
中CMainFrame的OnCreate中
改变程序左上角的光标
::SetCursor(m_hCursor);
BOOL MyDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(AfxGetApp()->LoadCursor(IDC_MYCURSOR));
return TRUE;
//return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
如果只想用等待光标,拥CWaitCursor更为方便