Clipping cursor still active after stopping debugger :-O

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);
    }
}

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted October 26, 2006 at 9:15 am | Permalink

    Somebody pointed out the reason for the same.

    “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.”

One Trackback

  1. [...]     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);     }} Posted by S a r a t hIt’s useful article i think.Link to original article [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>