用户登录
用户注册

分享至

获得.net控件的windows句柄的方法

  • 作者: Wizard丶
  • 来源: 51数据库
  • 2021-08-20

复制代码 代码如下:

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

    

软件
前端设计
程序设计
Java相关