标题:【原创】VB6伪造显示器损坏
取消只看楼主
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
结帖率:89.13%
 问题点数:0 回复次数:0 
【原创】VB6伪造显示器损坏
无聊写了以下程序,有更好的线条画法,请下方留言。

窗体拖入控件:Timer1 执行以下代码:

程序代码:
Option Explicit
'窗体透明,控件不透明
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = &H1
'窗体置顶
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)


Private Sub Form_Load()
Dim i As Long, j As Long
If App.PrevInstance = True Then End '如果重复进程,则退出
Form1.AutoRedraw = True
Form1.ScaleMode = vbPixels
Form1.DrawWidth = 1.45

'窗体全屏
Me.BorderStyle = False
Me.Caption = ""
Me.Move 0, 0, Screen.Width, Screen.Height

'窗体透明
BackColor = &HFEFEFE
SetWindowLong hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes hwnd, &HFEFEFE, 0, LWA_COLORKEY '这里的 0 表示透明度

'绘制线条
For i = Form1.ScaleWidth / 3 To Form1.ScaleWidth / 3 + 6 Step 2
Form1.Line (Form1.ScaleWidth / 3 + i, 0)-(Form1.ScaleWidth / 3 + i, Form1.Height), Int(16581375 * Rnd + 0)
Next

For j = Form1.ScaleWidth / 3 + 10 To Form1.ScaleWidth / 3 + 16 Step 2
Form1.Line (Form1.ScaleWidth / 3 + j, 0)-(Form1.ScaleWidth / 3 + j, Form1.Height), Int(16581375 * Rnd + 0)
Next

Timer1.Interval = 1000

End Sub
Private Sub Timer1_Timer()
'让窗体在顶层
Dim rtn
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
End Sub
搜索更多相关主题的帖子: hwnd ByVal 窗体 Long Private 
2023-02-10 10:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-511250-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.097965 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved