zoukankan      html  css  js  c++  java
  • 截屏函数

     1 Option Explicit
     2 
     3 Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As LongAs Long
     4 Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As LongAs Long
     5 Private Declare Function EmptyClipboard Lib "user32" () As Long
     6 Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As LongAs Long
     7 Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As LongAs Long
     8 Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As LongAs Long
     9 Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As LongAs Long
    10 Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As LongAs Long
    11 Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As LongAs Long
    12 Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As LongAs Long
    13 Private Declare Function CloseClipboard Lib "user32" () As Long
    14 
    15 Sub ScrnCap(Lt, Top, Rt, Bot)
    16     Dim rWidth, rHeight, SourceDC, DestDC, BHandle, Wnd, DHandle
    17     rWidth = Rt - Lt
    18     rHeight = Bot - Top
    19     SourceDC = CreateDC("DISPLAY"000)
    20     DestDC = CreateCompatibleDC(SourceDC)
    21     BHandle = CreateCompatibleBitmap(SourceDC, rWidth, rHeight)
    22     SelectObject DestDC, BHandle
    23     BitBlt DestDC, 00, rWidth, rHeight, SourceDC, Lt, Top, &HCC0020
    24     Wnd = Screen.ActiveForm.hwnd
    25     OpenClipboard Wnd
    26     EmptyClipboard
    27     SetClipboardData 2, BHandle
    28     CloseClipboard
    29     DeleteDC DestDC
    30     ReleaseDC DHandle, SourceDC
    31 End Sub
    32 
    33 Private Sub Command1_Click()
    34     Call ScrnCap(001024768)
    35 End Sub
    36 
  • 相关阅读:
    Pytorch:常用工具模块
    Pytorch: torch.nn
    流行框架阶段·概览
    jquery/js实现一个网页同时调用多个倒计时(最新的)
    用js判断页面刷新或关闭的方法
    js中substr,substring,indexOf,lastIndexOf,split 的用法
    jsonp案例
    CSS布局奇技淫巧:各种居中
    IntelliJ Idea 常用快捷键列表
    jquery中attr和prop的区别
  • 原文地址:https://www.cnblogs.com/xxaxx/p/1635334.html
Copyright © 2011-2022 走看看