Click here to Skip to main content
15,881,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got stuck with an issue in property sheet .I want to load different cursor when the mouse position is within the client area and load another when moves out of the client area.

In the porpetysheet I added four page. In the first page when I click next I am loading cursor of IDC_WAIT type and loading IDC_ARROW when the mouse moves out of the client area.

In the page class I triggered the event for WM_MOUSEMOVE as follow:

MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)

LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if(TRUE == m_bIsNextBtnClicked)
::SetCursor(LoadCursor(NULL, IDC_WAIT));
else
::SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
}

This event is getting triggered and absolutely had no issue with this. Similarly I tried adding `MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)` this event making an assumption that this will get triggered if the mouse moves out of the client area, but this event did not get triggered at all.If this is not the mouse event to be triggered for mouseleave which event should I trigger?

LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
::SetCursor(LoadCursor(NULL, IDC_ARROW));

return TRUE;
}

Now when I click Next button , **I was actually calling a function which is taking sometime to return** . Before to this function I am loading IDC_WAIT cursor i.e.,

`::SetCursor(LoadCursor(NULL, IDC_WAIT));` .

Now when move the mouse cursor on to the non-client area I want to load IDC_ARROW cursor i.e.,

::SetCursor(LoadCursor(NULL, IDC_ARROW));

When the moves on to the non-client area I am handling the mouse event in sheet derived class as follows,

MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnNCMouseMove)
LRESULT OnNCMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
::SetCursor(LoadCursor(NULL, IDC_ARROW));

return 0;
}
This event is not getting triggered until unless the function in the Next button event is executed.

I want both of them to be done in parallel i.e, click Next button now hover mouse on the client area, Busy icon should come and when mouse moves out of the client area then IDC_ARROW icon should come.

LRESULT OnWizardNext()
{

::SetCursor(LoadCursor(NULL, IDC_WAIT));
m_bIsNextBtnIsClicked = TRUE;
BOOL bRet = MyFun();
m_bIsNextBtnIsClicked = FALSE;
//Until this function is executed **WM_NCMOUSEMOVE**

//event is not getting triggered.But this event should get triggered and I

//should be able to see the change of cursor within and out of client area.

}

Can anyone kindly help me to solve this issue.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900