| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 665 人关注过本帖
标题:【原创】VB6伪造显示器损坏
只看楼主 加入收藏
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1934
专家分:3012
注 册: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
快速回复:【原创】VB6伪造显示器损坏
数据加载中...
 
   



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

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