zoukankan      html  css  js  c++  java
  • 0717的一个错误写法

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.Runtime.InteropServices;
     5 namespace ConsoleApplication1
     6 {
     7 class Program
     8 {
     9 //Win32 API
    10 [DllImport("User32.dll")]
    11 public static extern int GetSystemMetrics(int nIndex);
    12 static void Main(string[] args)
    13 {
    14 int Width,Height;
    15 double LineWidth, Size;
    16 Width=GetSystemMetrics(0);
    17 Height = GetSystemMetrics(1);
    18 //验证
    19 Console.WriteLine("{0}*{1}", Width, Height);
    20 Console.ReadKey();
    21 LineWidth = (((Width * 24) + 31) & (0x7FFFFFFF - 31)) >> 3; //对齐后每行数据长度
    22 Size = LineWidth * Height;
    23 //验证
    24 Console.WriteLine("{0};{1}", LineWidth, Size);
    25 Console.ReadKey();
    26 GetMem(Bits, Size);//动态分布内存
    27 //截图
    28 Wnd=GetDesktopWindow(); //获取桌面句柄
    29 DC = GetWindowDC(Wnd); //返回hWnd参数所指定的窗口的设备环境
    30 MemDC = CreateCompatibleDC(DC); //该函数创建一个与指定设备兼容的内存设备上下文环境
    31 Bitmap = CreateCompatibleBitmap(DC, Width, Height); //创建与指定的设备环境相关的设备兼容的位图
    32 OldBitmap=SelectObject(MemDC,Bitmap); //选择一对象到指定的设备上下文环境中
    33 BitBlt(MemDC,0,0,Width,Height,DC,0,0,SRCCOPY); //
    34 Bitmap=SelectObject(MemDC,OldBitmap);
    35 }
    36 }
    37 }
    365个夜晚,我希望做到两天更一篇博客。加油,小白!
  • 相关阅读:
    Codeforces Round #498 (Div. 3) E. Military Problem
    codeforces ~ 1009 B Minimum Ternary String(超级恶心的思维题
    二叉排序树
    codeforces ~ 1004 C Sonya and Robots (dp)
    fragment shader的优化
    计算带宽
    trilinear filter
    GPU bubbles
    Dx12 occlusion query
    非意外的PDB错误 OK(0)
  • 原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/11202759.html
Copyright © 2011-2022 走看看