WinAPI.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace WindowCaptureDemo
{
    class WinAPI
    {
        public struct RECT
        {
            public int x1;
            public int y1;
            public int x2;
            public int y2;
        }

            [DllImport("user32.dll")]
            private static extern IntPtr GetDC(IntPtr hwnd);
            [DllImport("user32.dll")]
            private static extern IntPtr ReleaseDC(IntPtr hc, IntPtr hDest);
            [DllImport("user32.dll")]
            private static extern IntPtr GetWindowDC(IntPtr hwnd);
            [DllImport("user32.dll")]
            private static extern IntPtr GetForegroundWindow();
            [DllImport("user32.dll")]
            private static extern IntPtr GetWindowRect(IntPtr hWnd, out RECT rect);
            [DllImport("user32.dll")]
            private static extern bool PrintWindow(IntPtr hwnd, IntPtr hdcBlt, UInt32 nFlags);
            [DllImport("user32.dll")]
            private static extern IntPtr GetDesktopWindow();

            [DllImport("gdi32.dll")]
            private static extern IntPtr CreateDC(
                 string lpszDriver,         // driver name驱动名
                 string lpszDevice,         // device name设备名
                 string lpszOutput,         // not used; should be NULL
                 IntPtr lpInitData          // optional printer data
             );
            [DllImport("gdi32.dll")]
            private static extern int BitBlt(
                 IntPtr hdcDest, // handle to destination DC目标设备的句柄
                 int nXDest,   // x-coord of destination upper-left corner目标对象的左上角的X坐标
                 int nYDest,   // y-coord of destination upper-left corner目标对象的左上角的Y坐标
                 int nWidth,   // width of destination rectangle目标对象的矩形宽度
                 int nHeight, // height of destination rectangle目标对象的矩形长度
                 IntPtr hdcSrc,   // handle to source DC源设备的句柄
                 int nXSrc,    // x-coordinate of source upper-left corner源对象的左上角的X坐标
                 int nYSrc,    // y-coordinate of source upper-left corner源对象的左上角的Y坐标
                 CopyPixelOperation dwRop   // raster operation code光栅的操作值
             );
            //static extern int BitBlt(IntPtr hdcDest, int xDest, int yDest, int
            //wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, CopyPixelOperation rop);

            [DllImport("gdi32.dll")]
后面还有 193 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。