[DllImport("user32.dll")]
static extern IntPtr SetCapture(IntPtr hWnd);
Declare Function SetCapture Lib "user32.dll" (ByVal hWnd As IntPtr) As IntPtr
None.
None.
You can use SetCapture in conjunction with GetCapture to obtain the window handle of a Control. See the sample code below.
public IntPtr GetHWnd(Control ctrl)
{
IntPtr hOldWnd = GetCapture();
ctrl.Capture = true;
IntPtr hWnd = GetCapture();
ctrl.Capture = false;
SetCapture(hOldWnd);
return hWnd;
}
None