还是不行呀,这个光标无法移出对话框呀!移出后就变成系统默认的了
我是这么设置的
BOOL CClientUpdate3Dlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
if(pMsg->wParam==VK_F12)
{
MessageBox("F12");
//::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
SetCapture();
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
}
return CDialog::PreTranslateMessage(pMsg);
}
就你上面的代码看, 你的想法就是错的
SPY++的十字光标, 也只限于一直按住鼠标左键再可以(就像我上面的代码一样), 松开就不行了
只要你的鼠标离开你的窗体, 鼠标光标就不属于你管了,虽然用 SetCapture可以强制将鼠标消
息发送到你的窗体, 但也只能在 LButtonDown中设置才可以(也就是鼠标按键必须一直按着), 具体原因我也不知道
请看 MSDN
The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input. In systems without a mouse, the window should restore the previous cursor before the cursor leaves the client area or before it relinquishes control to another window
光标是一个共享资源, 窗体只能在鼠标处于窗体的客户区时, 才可以设置它, 只要鼠标离开窗体的客户区, WINDOW将恢复以前的光标