Figure 1: Typical drag/drop code fragment
case WM_LBUTTONDOWN: SetCapture(hwnd); bDragging = TRUE; // perform initializations (e.g. allocate memory) return(0); case WM_MOUSEMOVE: if (bDragging) DoDragStuff(); return(0); case WM_LBUTTONUP: if (bDragging) { ReleaseCapture(); bDragging = FALSE; // complete the drag operation // clean up (e.g. free memory) } return(0);