正在阅读:活用C#截取计算机屏幕活用C#截取计算机屏幕

2004-07-07 09:49 出处:CSDN 作者:AppleDotnet 责任编辑:linjixiong

所用到的API声明:


[DllImport("gdi32.dll")]
public static extern IntPtr CreateDC(
 string lpszDriver,        // driver name
 string lpszDevice,        // device name
 string lpszOutput,        // not used; should be NULL
 Int64 lpInitData  // optional printer data
 );
 
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleDC(
 IntPtr hdc // handle to DC
 );
 
[DllImport("gdi32.dll")]
public static extern int GetDeviceCaps(
 IntPtr hdc,     // handle to DC
 GetDeviceCapsIndex nIndex   // index of capability
);

[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleBitmap(
 IntPtr hdc,        // handle to DC
 int nWidth,     // width of bitmap, in pixels
 int nHeight     // height of bitmap, in pixels
 );

[DllImport("gdi32.dll")]
public static extern IntPtr SelectObject(
 IntPtr hdc,          // handle to DC
 IntPtr hgdiobj   // handle to object
 );

[DllImport("gdi32.dll")]
public static extern int BitBlt(
 IntPtr hdcDest, // handle to destination DC
 int nXDest,  // x-coord of destination upper-left corner
 int nYDest,  // y-coord of destination upper-left corner
 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
 int nYSrc,   // y-coordinate of source upper-left corner
 UInt32 dwRop  // raster operation code
 );

[DllImport("gdi32.dll")]
public static extern int DeleteDC(
 IntPtr hdc          // handle to DC
 );

 

 

键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品