   Problem using SetCapture
  I am creating a Windows application. I noticed that when the user presses the left mouse button while inside the window, then moves the mouse outside the window, and then releases the left mouse button, my program doesn't receive the WM_LBUTTONUP message. This is very annoying if the user has to drag the mouse to change the view. To solve this, I tried adding this to my WindowProc function:case WM_SETFOCUS:SetCapture(windowhandle);hasfocus = true;return 0;Unfortunately this doesn't work very well: it freezes the window. The program still runs and can still receive input, but the window can't be moved or resized and the close button doesn't work anymore. The cursor image is also wrong (it doesn't change anymore).How should I use SetCapture()?   
  I believe you should only SetCapture when the mouse is down, as that is the only time you want to always receive mouse events. Once the mouse is released, ReleaseCapture so you can still do normal operations like moving or sizing the window. I don't know that much about Win32 programming so I'm not sure if that will work, but give it a go and see if it works   