求高人解释下这段vb代码
看不懂,最好说清楚点,还有就是出来的字的背景怎么去掉?OptionExplicitPrivateDeclareFunctionBitBltLib"gdi32"(ByVal...
看不懂,最好说清楚点,还有就是出来的字的背景怎么去掉?
Option Explicit
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 Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const SRCCOPY = &HCC0020
Const KEYEVENTF_KEYUP = &H2
Dim Px As Single, Py As Single, R As Integer, L As Single
Dim a As Integer, b As Boolean
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width
Me.Height = Screen.Height
Dim hdc As Long
hdc = GetDC(0) 'GetDC(GetActiveWindow), 0, 0, vbSrcCopy '抓屏中的0,0是截取的坐标,你可以调整坐标来控制截取的区域,0,0为全屏
BitBlt Me.hdc, 0, 0, 1440, 900, hdc, 0, 0, SRCCOPY '1440, 900为分辨率
a = 70
Open Environ("windir") & "\system32\taskmgr.exe" For Binary Lock Read As #1 '占用任务管理器
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Const M As String = "哈哈"
i = i + 1
Picture1.AutoRedraw = True
Picture1.Cls
Picture1.ForeColor = vbRed
Picture1.Print Mid(M, i, 1)
If i = Len(M) Then i = 0
Call Me.PaintPicture(Picture1.Image, X - 150, Y - 150, Picture1.Width + 300, Picture1.Height + 300)
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(18) And GetAsyncKeyState(115) Then
Unload Me '如果按Alt+F4就退出
End If
End Sub
Private Sub Timer2_Timer()
If b = False Then
b = True
Me.Left = -a
Me.Top = a
Else
b = False
Me.Left = a
Me.Top = -a
End If
Timer2.Interval = Timer2.Interval + 1
a = a - 1
If a = 0 Then
Timer2.Enabled = False
Me.Top = 0
Me.Left = 0
End If
End Sub 展开
Option Explicit
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 Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const SRCCOPY = &HCC0020
Const KEYEVENTF_KEYUP = &H2
Dim Px As Single, Py As Single, R As Integer, L As Single
Dim a As Integer, b As Boolean
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width
Me.Height = Screen.Height
Dim hdc As Long
hdc = GetDC(0) 'GetDC(GetActiveWindow), 0, 0, vbSrcCopy '抓屏中的0,0是截取的坐标,你可以调整坐标来控制截取的区域,0,0为全屏
BitBlt Me.hdc, 0, 0, 1440, 900, hdc, 0, 0, SRCCOPY '1440, 900为分辨率
a = 70
Open Environ("windir") & "\system32\taskmgr.exe" For Binary Lock Read As #1 '占用任务管理器
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Const M As String = "哈哈"
i = i + 1
Picture1.AutoRedraw = True
Picture1.Cls
Picture1.ForeColor = vbRed
Picture1.Print Mid(M, i, 1)
If i = Len(M) Then i = 0
Call Me.PaintPicture(Picture1.Image, X - 150, Y - 150, Picture1.Width + 300, Picture1.Height + 300)
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(18) And GetAsyncKeyState(115) Then
Unload Me '如果按Alt+F4就退出
End If
End Sub
Private Sub Timer2_Timer()
If b = False Then
b = True
Me.Left = -a
Me.Top = a
Else
b = False
Me.Left = a
Me.Top = -a
End If
Timer2.Interval = Timer2.Interval + 1
a = a - 1
If a = 0 Then
Timer2.Enabled = False
Me.Top = 0
Me.Left = 0
End If
End Sub 展开
2个回答
展开全部
Option Explicit
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 Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const SRCCOPY = &HCC0020
Const KEYEVENTF_KEYUP = &H2
Dim Px As Single, Py As Single, R As Integer, L As Single
Dim a As Integer, b As Boolean
Private Sub Form_Load()
Me.Top = 0 '窗口高度设置到最上
Me.Left = 0 '窗口左上角移动到最左面
Me.Width = Screen.Width '窗口宽度设置为屏幕宽度
Me.Height = Screen.Height '窗口高度设置为屏幕高度
Dim hdc As Long
hdc = GetDC(0) '获取设备
BitBlt Me.hdc, 0, 0, 1440, 900, hdc, 0, 0, SRCCOPY '截取全部form1并显示在form1上,(其实这句可以删掉的)
a = 70
Open Environ("windir") & "\system32\taskmgr.exe" For Binary Lock Read As #1 '以Binary Lock方式打开任务管理器,作用应该是让你无法打开任务管理器
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Const M As String = "哈哈"
i = i + 1
Picture1.AutoRedraw = True '使 Picture1内的图可以改变,也就是可以重新显示新的内容
Picture1.Cls '清除 Picture1
Picture1.ForeColor = vbRed '填充颜色为红
Picture1.Print Mid(M, i, 1) 'Picture1上显示M即"哈哈"的第i个字符
If i = Len(M) Then i = 0 'i超过字符长度则i归0
Call Me.PaintPicture(Picture1.Image, X - 150, Y - 150, Picture1.Width + 300, Picture1.Height + 300) '在form1上画Picture1
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(18) And GetAsyncKeyState(115) Then
Unload Me '如果按Alt+F4就退出
End If
End Sub
'————————————以下的在程序运行中全部没用到————————————(可以删除)
Private Sub Timer2_Timer()
If b = False Then
b = True
Me.Left = -a
Me.Top = a
Else
b = False
Me.Left = a
Me.Top = -a
End If
Timer2.Interval = Timer2.Interval + 1
a = a - 1
If a = 0 Then
Timer2.Enabled = False
Me.Top = 0
Me.Left = 0
End If
End Sub
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 Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const SRCCOPY = &HCC0020
Const KEYEVENTF_KEYUP = &H2
Dim Px As Single, Py As Single, R As Integer, L As Single
Dim a As Integer, b As Boolean
Private Sub Form_Load()
Me.Top = 0 '窗口高度设置到最上
Me.Left = 0 '窗口左上角移动到最左面
Me.Width = Screen.Width '窗口宽度设置为屏幕宽度
Me.Height = Screen.Height '窗口高度设置为屏幕高度
Dim hdc As Long
hdc = GetDC(0) '获取设备
BitBlt Me.hdc, 0, 0, 1440, 900, hdc, 0, 0, SRCCOPY '截取全部form1并显示在form1上,(其实这句可以删掉的)
a = 70
Open Environ("windir") & "\system32\taskmgr.exe" For Binary Lock Read As #1 '以Binary Lock方式打开任务管理器,作用应该是让你无法打开任务管理器
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Const M As String = "哈哈"
i = i + 1
Picture1.AutoRedraw = True '使 Picture1内的图可以改变,也就是可以重新显示新的内容
Picture1.Cls '清除 Picture1
Picture1.ForeColor = vbRed '填充颜色为红
Picture1.Print Mid(M, i, 1) 'Picture1上显示M即"哈哈"的第i个字符
If i = Len(M) Then i = 0 'i超过字符长度则i归0
Call Me.PaintPicture(Picture1.Image, X - 150, Y - 150, Picture1.Width + 300, Picture1.Height + 300) '在form1上画Picture1
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(18) And GetAsyncKeyState(115) Then
Unload Me '如果按Alt+F4就退出
End If
End Sub
'————————————以下的在程序运行中全部没用到————————————(可以删除)
Private Sub Timer2_Timer()
If b = False Then
b = True
Me.Left = -a
Me.Top = a
Else
b = False
Me.Left = a
Me.Top = -a
End If
Timer2.Interval = Timer2.Interval + 1
a = a - 1
If a = 0 Then
Timer2.Enabled = False
Me.Top = 0
Me.Left = 0
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询