module1.bas

来自「光盘管家」· BAS 代码 · 共 41 行

BAS
41
字号
Attribute VB_Name = "Module1"
Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Public CdromName As String
Public BackupFileArray() As String
Public RestoreFile() As String
Public Info As String
Public Sub CencerForm(fForm As Form)
fForm.Move (Screen.Width - fForm.Width) / 2, (Screen.Height - fForm.Height) / 2
End Sub
Public Sub GetFoldersAndFiles(Foldername As String)
Dim fso As New Scripting.FileSystemObject
Dim fd As Folder, sfd As Folder, fs As File
Set fd = fso.GetFolder(Foldername)
For Each sfd In fd.SubFolders
    MainForm.TreeView2.Nodes.Add Foldername, tvwChild, sfd.Path + "\", sfd.Name, 3, 2
    AddCdrom.Label3.Caption = sfd.Path
    GetFoldersAndFiles sfd.Path + "\"
Next
For Each fs In fd.Files
    MainForm.TreeView2.Nodes.Add Foldername, tvwChild, fs.Path, fs.Name, 10
    AddCdrom.Label3.Caption = fs.Path
Next
End Sub


Public Sub main()
If Dir("cdrom.cds") = "" Then
   MsgBox "光盘镜像注册表丢失,请重装系统!", vbCritical
   End
End If
If App.PrevInstance Then
   MsgBox "光盘管家已经被启动,无须再开启了!", vbCritical
   End
Else
  Load MainForm
  MainForm.Show
End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?