实现代码如下:

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;
  }
}

    

以上就是【获得.net控件的windows句柄的方法】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论