frmmain.frm

来自「可用的在线升级源码子程序」· FRM 代码 · 共 66 行

FRM
66
字号
VERSION 5.00
Begin VB.Form frmMain 
   Caption         =   "请点击升级进行程序"
   ClientHeight    =   1140
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4500
   LinkTopic       =   "Form1"
   ScaleHeight     =   1140
   ScaleWidth      =   4500
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "升级"
      Height          =   525
      Left            =   1380
      TabIndex        =   0
      Top             =   570
      Width           =   1245
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' 这里是没有升级时的主程序

Private Sub Command1_Click()

  Command1.Enabled = False

  ' 运行更新程序

  Shell App.Path & "\update.exe", vbNormalFocus
  
End Sub

Private Sub Form_Load()
  
  If App.PrevInstance Then End

  UpdateIniPath = App.Path & "\Update.ini"

  ' 记录主程序的名字

  WritePrivateProfileString "Main", "Name", App.EXEName, UpdateIniPath

  ' 记录运行状态

  WritePrivateProfileString "Main", "Active", "-1", UpdateIniPath

  ' 记录更新次数

  WritePrivateProfileString "Update", "Num", "0", UpdateIniPath

  Me.Caption = App.EXEName

End Sub

Private Sub Form_Unload(Cancel As Integer)
   ' 记录运行状态
  WritePrivateProfileString "Main", "Active", "0", UpdateIniPath

End Sub

⌨️ 快捷键说明

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