VB.NET/VB6 调用QQ,微信截图DLL动态库文件,实现截图功能


众所周知QQ和微信的截图功能非常强大;那么这么强大的功能不能直接嵌入我们自己开发的程序呢?答案显而易见;这是完全没有问题的;

经过对QQ和微信的内的所有DLL文件对比,发现QQ是使用CameraDll.DLL动态库来实现截图的;而微信则使用PrScrn.dll动态库来实现截图功能的,

本示例用的动态库版本如下;

QQ截图动态库版本:

CameraDll.DLL 版本为 3.2.805.201

微信截图动态库版本:

PrScrn.DLL 版本为 8.0.503.400


VB.NET动态库引用代码示例:

微信截图示例:

Public Class WXDLL
    ''' <summary>
    ''' 微信普通截图
    ''' </summary>
    ''' <returns></returns>
    <Runtime.InteropServices.DllImport("PrScrn.dll", EntryPoint:="PrScrn")>
    Public Shared Function PrScrn() As Integer
    End Function

End Class

(提示:左右滑动查看完整代码)

QQ截图示例:

Public Class QQDLL
    ''' <summary>
    ''' QQ调用普通截图
    ''' </summary>
    ''' <returns></returns>
    <Runtime.InteropServices.DllImport("CameraDLL.dll", EntryPoint:="CameraSubArea")>
    Public Shared Function CameraSubArea(ByVal handle As Long) As Long
    End Function

    ''' <summary>
    ''' QQ根据窗口截图
    ''' </summary>
    ''' <returns></returns>
    <Runtime.InteropServices.DllImport("CameraDLL.dll", EntryPoint:="CameraWindowLikeSpy")>
    Public Shared Function CameraWindowLikeSpy() As Integer
    End Function

End Class

(提示:左右滑动查看完整代码)

适用于VB6和VB.NET动态库引用代码示例:

微信截图示例:

 Public Declare Function PrScrn Lib "PrScrn.dll" Alias "PrScrn" () As Integer

(提示:左右滑动查看完整代码)

QQ截图示例:

 Public Declare Function pCameraSubArea Lib "CameraDll.DLL" Alias "CameraSubArea" (ByVal handle As Long) As Long
    Public Declare Function CameraWindowLikeSpy Lib "CameraDLL.dll" Alias "CameraWindowLikeSpy" () As Integer

(提示:左右滑动查看完整代码)


******************代码引用方法***************

在面板上添加控件;三个按钮,一个图片显示框;

按钮1代码:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim a As Long

a = QQDLL.CameraSubArea(0)

If a > 0 Then

PictureBox1.Image = My.Computer.Clipboard.GetImage

End If

End Sub

按钮2代码:

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

Dim a As Integer

a = QQDLL.CameraWindowLikeSpy

If a > 0 Then

PictureBox1.Image = My.Computer.Clipboard.GetImage

End If

End Sub

按钮3代码:

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

Dim a As Integer

a = WXDLL.PrScrn()

If a > 0 Then

PictureBox1.Image = My.Computer.Clipboard.GetImage

End If

End Sub


今天教程此结束!谢谢关注与支持!

原文发布于微信公众号 - VB小源码(vb_xym)

原文发表时间:2019-07-17

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券