要建6个窗体。。窗体1有个计时器。。其他的窗体就加个PictureBox。。把窗体属性中的 BorderStyle 改为 0 - None 还有 StartUpPosition 改为 2 - 萤幕中心
还有把 Width 和 Height 改为最大。。。。或者把 WindowState 改为 2 - MaxmizedFocusPictureBox 就装入你那图片
'通用代码
Const TH32CS_SNAPHEAPLIST = &H1
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Function exitproc(ByVal exefile As String) As Boolean
exitproc = False
Dim hSnapShot As Long, uProcess As PROCESSENTRY32
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
r = Process32First(hSnapShot, uProcess)
Do While r
If Left$(uProcess.szExeFile, IIf(InStr(1, uProcess.szExeFile, Chr$(0)) >0, InStr(1, uProcess.szExeFile, Chr$(0)) - 1, 0)) = exefile Then
exitproc = True
Exit Do
End If
r = Process32Next(hSnapShot, uProcess)
Loop
End Function
Private Sub Form_Load()
Me.Hide
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Time()
If exitproc("abc.exe") = True Then
While 1 <>2
Form2.Show
Form3.Show
Form4.Show
Form5.Show
Form6.Show
Wend
End If
End Sub
窗体2 3 4 5 6 的代码
Private Sub Form_Resize()
Picture1.Height = Me.Height
Picture1.Width = Me.Width
End Sub
整人VB小程序:蓝屏死机
本程序启动后,延时指定的时间(默认10秒)后出现蓝屏,模拟蓝屏死机情形。此时,用户无法使用开始菜单、任务管理器,无法 *** 作任何程序,只能干着急。
1 秒钟后,在蓝屏的背景上显示:Your Windows is died 5 秒钟后,显示:Windows 警告 内存出现严重错误 10 秒钟后,显示并计数:警告 硬盘错误,无法正常运行 Windows,Windows 正在试图修复所有错误,请等待 100 秒…… 25 秒钟后,显示:警告 由于你使用了盗版 *** 作系统 微软惩罚你:定期死机
此后,这 4 条信息交替显示 结束本程序的方式有两个:
1.用鼠标单击屏幕左上角,连续 5 次(左上角 20 个像素范围的区域,大约 1 平方厘米的大小)
2.到程序设定的时间后自动结束,默认 120 秒。 下面是程序运行截图
''
以下是窗体代码,在
VB6.0
上调试通过:
'
一、在窗体添加一个定时器控件:
Timer1
,不必设置任何属性,
采用默认属性即可
'
二、在属性窗口将窗体的
BorderStyle
属性设置为
0
Dim ctCi As Long, ctT As Long, ctExitT As Long, ctStr() As String,
ctStrS As Long, ctExit As Boolean
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
Dim ctShowT As Long
Private Sub Form_Load()
ctShowT = 10
'****
运行程序后,
延时显示蓝屏的时间
(秒)
,
可根据自己的喜好设定
Me.BackColor = RGB(0, 0, 255): Me.Caption = "
蓝屏死机
"
Me.AutoRedraw = True: Me.WindowState = 2
Me.Font.Size = 21: Me.ForeColor = &HFFFFFF
Timer1.Interval = 50: Timer1.Enabled = True
ReDim ctStr(0 To 0)
End Sub
Private Sub Form_Click()
If ctExit Then Unload Me
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
'
单击左上角
20
个像素范围
Dim S1 As Single
S1 = Me.ScaleX(20, 3, Me.ScaleMode)
If X > S1 Or Y > S1 Then ctCi = 0: Exit Sub
ctCi = ctCi + 1
If ctCi > 4 Then Call ExitInf
End Sub
Private Sub ExitInf()
ctExitT = 120
'****
程序自动退出的时间(秒),可根据自己的
喜好设定
Me.Hide
说的是这个吗? 那个程序会让电脑1分钟内关机,并且显示“请输入'我是弱智'”,他才会停止关机,并d出一个框:早这样说不就好了吗。 如果需要这个 你反问我就好了。 如果你只需要源码
。。记得 反问。。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)