Clipping cursor still active after stopping debugger
-
I have written code in Visual Studio 2005 to show list box as a pop-up window. On Clicking the main window, I show/hide the window accordingly. Yea the program working as I expected without having any problems. When I had some issues, i decided to debug the program. On showing the Listbox( cursor will be clipped ), I stopped debugging using Shift+F5. The thing is, the Cursor Clipping was still there. After closing some opened windows from Visual Studio IDE and Switching to other windows resolved issue. but it was hectic for minute. I’m sure the process was not at all active. because it’s a very small application which exit on Shift+F5 press
// Code to clip the cursor on showing/hdie the window
void CListBoxEx::OnShowWindow(BOOL bShow, UINT nStatus)
{
CListBox::OnShowWindow(bShow, nStatus);if( SW\_SHOWNORMAL == bShow ) // Clip the cursor if window showing { CRect rect; GetWindowRect(rect); ClipCursor( rect ); } else if( SW\_HIDE == bShow ) // remove clipping on hiding { ClipCursor(NULL); }
}
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
I have written code in Visual Studio 2005 to show list box as a pop-up window. On Clicking the main window, I show/hide the window accordingly. Yea the program working as I expected without having any problems. When I had some issues, i decided to debug the program. On showing the Listbox( cursor will be clipped ), I stopped debugging using Shift+F5. The thing is, the Cursor Clipping was still there. After closing some opened windows from Visual Studio IDE and Switching to other windows resolved issue. but it was hectic for minute. I’m sure the process was not at all active. because it’s a very small application which exit on Shift+F5 press
// Code to clip the cursor on showing/hdie the window
void CListBoxEx::OnShowWindow(BOOL bShow, UINT nStatus)
{
CListBox::OnShowWindow(bShow, nStatus);if( SW\_SHOWNORMAL == bShow ) // Clip the cursor if window showing { CRect rect; GetWindowRect(rect); ClipCursor( rect ); } else if( SW\_HIDE == bShow ) // remove clipping on hiding { ClipCursor(NULL); }
}
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
AFAIK, Cursor clipping is handled by the OS/Window Manager/whatever. Not the app; the app just tells the OS what the clipping should be for a given desktop. So yeah, if your program fails to remove clipping for whatever reason, it sticks around. BTW - how is this a subtle bug?
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?
-
I have written code in Visual Studio 2005 to show list box as a pop-up window. On Clicking the main window, I show/hide the window accordingly. Yea the program working as I expected without having any problems. When I had some issues, i decided to debug the program. On showing the Listbox( cursor will be clipped ), I stopped debugging using Shift+F5. The thing is, the Cursor Clipping was still there. After closing some opened windows from Visual Studio IDE and Switching to other windows resolved issue. but it was hectic for minute. I’m sure the process was not at all active. because it’s a very small application which exit on Shift+F5 press
// Code to clip the cursor on showing/hdie the window
void CListBoxEx::OnShowWindow(BOOL bShow, UINT nStatus)
{
CListBox::OnShowWindow(bShow, nStatus);if( SW\_SHOWNORMAL == bShow ) // Clip the cursor if window showing { CRect rect; GetWindowRect(rect); ClipCursor( rect ); } else if( SW\_HIDE == bShow ) // remove clipping on hiding { ClipCursor(NULL); }
}
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
From the documentation for ClipCursor... "The cursor is a shared resource. If an application confines the cursor, it must release the cursor by using ClipCursor before relinquishing control to another application"