VB远程屏幕扫描算法

该博客介绍了VB实现的远程屏幕扫描算法,利用CreateDIBSection创建位图内存,通过RtlCompareMemory进行内核级比对,使用BitBlt进行Xor运算合并像素,并借助zlib库进行位图压缩。高效的关键包括获取桌面物理地址、优化汇编运算及利用WM_PAINT钩子检测桌面变化。
摘要由CSDN通过智能技术生成

扫描在程序中原理:


举例:

1.CreateDIBSection建位临时位图内存。

2.RtlCompareMemory属于系统内核内存比对函数。相当汇编级别。

2.BitBlt对2个位图内存扫描不点点(光栅运算(vbSrcInvert(&H00660046 ))Xor 运算合并目标像素和源位图)。

3.下载zlib.dll,调用zlib压缩不同位图。

http://www.zlib.net/

Option Explicit
Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Const BI_RGB = 0&
Private Const DIB_RGB_COLORS = 0                  '     color   table   in   RGBs
Private Const BITSPIXEL As Long = 12
Private Const HORZRES = 8                         '  Horizontal width in pixels
Private Const VERTRES = 10                        '  Vertical width in pixels
Private Type BITMAPINFOHEADER                     '40   bytes
    biSize   As Long
    biWidth   As Long
    biHeight   As Long
    biPlanes   As Integer
    biBitCount   As Integer
    biCompression   As Long
    biSizeImage   As Long
    biXPelsPerMeter   As Long
    biYPelsPerMeter   As Long
    biClrUsed   As Long
    biClrImportant   As Long
End Type
Private Type RGBQUAD                              '只有bibitcount为1,2,4时才有调色板
    rgbBlue As Byte                               '蓝色分量
    rgbGreen As Byte                              '绿色分量
    rgbRed As Byte                                '红色分量
    rgbReserved As Byte                           '保留值
End Type


Private Type BITMAPINFO
    bmiHeader   As BITMAPINFOHEADER
    bmiColors   As RGBQUAD
End Type


Private Type BITMAPINFO256
    bmiHeader   As BITMAPINFOHEADER
    bmiColors(255) As Long
End Type


Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, _
    ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As Long) As Long


Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hD
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值