Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

waitcursor problem

doughydoughy Member Posts: 13
I need this function to show a waitcursor unless it's over one of the two buttons. The way this is now, the cursor is a hourglass no matter where the cursor is. here's the function:
[code]
BOOL CAboutDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
BOOL bReturn;
CRect rcBtn, rcBtn2;
CPoint ptCursor;

//calculate the current cursor position, and change the
//curso if we're not over the OK Button
CWnd* pBtn = GetDlgItem(IDOK);
pBtn->GetWindowRect(rcBtn);
CWnd* pBtn2 = GetDlgItem(IDCANCEL);
pBtn2->GetWindowRect(rcBtn2);
GetCursorPos(&ptCursor);
if (rcBtn.PtInRect(ptCursor) == FALSE || rcBtn2.PtInRect(ptCursor) == FALSE)
{
CDialog::OnSetCursor(pWnd, nHitTest, message);
SetCapture();
BeginWaitCursor();
}
else
{
ReleaseCapture();
EndWaitCursor();
CWinApp* pApp = AfxGetApp();
HICON hIconArrow = pApp->LoadCursor(IDC_ARROW);
SetCursor(hIconArrow);
bReturn = TRUE;
}
return bReturn;
}
[/code]
Sign In or Register to comment.