⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modmain.bas

📁 这个源代码主要模仿了一个类似 深度操作系统安装程序中的一个软件自动安装管理器AutoIt v3
💻 BAS
字号:
Attribute VB_Name = "modMain"

Option Explicit

'** 初始化 XP-Manifests

Public Type tagInitCommonControlsEx
    lngSize As Long
    lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "COMCTL32.DLL" _
    (iccex As tagInitCommonControlsEx) As Boolean

Private Const ICC_USEREX_CLASSES = &H200

Public Sub Main()

    On Error Resume Next
    
    If App.PrevInstance Then
       MsgBox ("程序已经运行或最小化到右下角的托盘中,不能再次装载!"), vbExclamation, "提示!"
       End
    End If

    Dim iccex As tagInitCommonControlsEx
    With iccex
        .lngSize = LenB(iccex)
        .lngICC = ICC_USEREX_CLASSES
    End With
    InitCommonControlsEx iccex
    
    Select Case Command$()
           Case "/auto"
              frmCountdown.Show vbModal
           Case "/uninstall"
              frmCountdown.Show vbModal
           Case "/del"
              frmCountdown.Show vbModal
           Case ""
              frmMain.Show
    End Select
End Sub


'判断文件是否存在
Public Function FileExists(fname$) As Boolean
    On Error Resume Next  '设置错误处理
    Dim freeX As Integer
 
    freeX = FreeFile      '取得一个空闲文件句柄
    Open fname$ For Input As freeX     '试图打开该文件
    If Err = 0 Then        '如果打开成功
        FileExists = True
    Else                   '否则
        FileExists = False
    End If
    Close freeX
End Function


'将Null结尾字符串转换到VB字符串
Public Function LPSTRToVBString$(ByVal s$)
    Dim nullpos&
    nullpos& = InStr(s$, Chr$(0))
    If nullpos > 0 Then
       LPSTRToVBString = Left$(s$, nullpos - 1)
    Else
       LPSTRToVBString = ""
    End If
End Function

⌨️ 快捷键说明

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