复制代码 代码如下:
class winapi
{
[dllimport("coredll.dll")]
private static extern intptr setcapture(intptr hwnd);
[dllimport("coredll.dll")]
private static extern intptr getcapture();
public static intptr gethwnd(control ctrl)
{
intptr holdwnd = getcapture();
ctrl.capture = true;
intptr hwnd = getcapture();
ctrl.capture = false;
setcapture(holdwnd);
return hwnd;
}
}