获得.net控件的windows句柄的方法
程序员文章站
2023-12-12 15:31:04
复制代码 代码如下:class winapi{ [dllimport("coredll.dll")] private static extern intptr setc...
复制代码 代码如下:
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;
}
}