亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時(shí)間:2013年04月15日 10:30:01   作者:  
有一個(gè)簡(jiǎn)單的獲得控件的句柄的竅門。你將窗體設(shè)置為鼠標(biāo)可捕獲,那么你的窗口句柄可以通過使用Windows API捕獲。 這個(gè)想法在以下的GetHWnd函數(shù)中實(shí)現(xiàn):

復(fù)制代碼 代碼如下:

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

    

相關(guān)文章

最新評(píng)論