zoukankan      html  css  js  c++  java
  • C# 截取窗口图像(包括遮挡窗口,最小化窗口)

       

            [DllImport("user32.dll")]
            public static extern bool PrintWindow(
             IntPtr hwnd,               // Window to copy,Handle to the window that will be copied. 
             IntPtr hdcBlt,             // HDC to print into,Handle to the device context. 
             UInt32 nFlags              // Optional flags,Specifies the drawing options. It can be one of the following values. 
             );
    
     
    
                //传入窗口句柄,获取该窗口的图像信息
    
           private Image GetWindowImage(IntPtr windownHandle)
           {
              Control control =Control.FromHandle(windownHandle);
              Bitmap image = new Bitmap(control.Width, control.Height);
              Graphics gp = Graphics.FromImage(image); 
              IntPtr dc = gp.GetHdc();
              PrintWindow(windownHandle, dc, 0);
              gp.ReleaseHdc();
              gp.Dispose();
              return image;
           }
  • 相关阅读:
    “数学题”——传钱
    kafka笔记——入门介绍
    SpringBoot集成Dubbo+Zookeeper
    MySql基本语法
    动态规划
    总结
    Java反射
    软件清单
    Java IO操作
    Spring Boot AOP的使用
  • 原文地址:https://www.cnblogs.com/xyz0835/p/3017445.html
Copyright © 2011-2022 走看看