中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > Visual Basic > 综合文章
用VB6.0编写自我升级的程序(二)
作者:未知 时间:2004-05-19 12:12 出处:Blog 责编:chinaitpower
              摘要:用VB6.0编写自我升级的程序(二)

 二、  projNewMain.vbp工程:

说明:这个是新的主程序,即升级后的主程序,由于我目前没有服务器,故将该程序放在projUpdate.vbp工程的资源文件中。在projUpdate.vbp中模拟网络升级。

 

用记事本打开frmNewMain.frm文件,copy以下内容到其中

 

VERSION 5.00

Begin VB.Form frmNewMain

   Appearance      =   0  'Flat

   BackColor       =   &H80000005&

   Caption         =   "Form1"

   ClientHeight    =   1365

   ClientLeft      =   60

   ClientTop       =   345

   ClientWidth     =   4680

   LinkTopic       =   "Form1"

   ScaleHeight     =   1365

   ScaleWidth      =   4680

   StartUpPosition =   3  '窗口缺省

   Begin VB.CommandButton Command1

      Caption         =   "升级"

      Height          =   525

      Left            =   1410

      TabIndex        =   0

      Top             =   660

      Width           =   1245

   End

   Begin VB.Label lblCap

      Caption         =   "告诉你,我已经升级了,没看出和以前不一样了吗?"

      Height          =   255

      Left            =   120

      TabIndex        =   1

      Top             =   60

      Width           =   4275

   End

End

Attribute VB_Name = "frmNewMain"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Option Explicit

 

' ------------------------------------------

' 升级程序的例子

' 作者:   谢家峰

' 日期:   2003/12/19

'

' 这里是升级后的主程序

'

' ------------------------------------------

 

 

Private Sub Command1_Click()

  Command1.Enabled = False

   

  ' 运行更新程序

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

 

End Sub

 

 

 

Private Sub Form_Load()

  Dim i As Integer

 

  If App.PrevInstance Then End

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

   

  ' 记录主程序的名字

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

  ' 记录运行状态

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

 

  Me.Caption = App.EXEName

 

End Sub

 

Private Sub Form_Unload(Cancel As Integer)

  ' 记录运行状态

  WritePrivateProfileString "Main", "Active", "0", UpdateIniPath

End Sub

 

 

三、 projUpdate.vbp工程:

说明:这是升级程序,含有一个资源文件。

 

用记事本打开frmUpdate.frm文件,copy以下内容到其中

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有