酵素的做法比例是多少:软件自动升级方法与解决方案

来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 09:00:45

件自动升级,就必须要原来的软件代替了。但是如何代替现在正在运行软件?

方法只有一种,即是用第三方法软件。这个第三方法软件可以好几种,1.是Bat(批处理软件)。2.自编软件。
这两种方式的程序编的是不相同的。

第一种:Bat软件的设计原理如下:
            1.通过程序得到需要升级的需求。 
            2.用程序生成一个Bat文件,通过Bat得到最新的软件。
            3.再关闭这个程序,并通过Bat得到代替原有的软件。再删除自动删除Bat文件。

第二种:自编升级软件,设计原理如下:
            1.通过程序得到需要升级的需求。
            2.关闭自己,并运行自编的软件,最后,得到这个软件,并覆盖软件。
            3.最后,关闭自动升级软件,并运行软件。

第一种的好处:不用再写升级软件。但是同时要定Bat处理过程软件。
第二种的好处:流程明确,并且可以通过进程条的形式显示程序更新的过程。(这种是比较流行的升级方式)。

==============

在设计本程序时,出现了两个问题:

第一:下载时,在本机可以实现,但是下载别的FTP时,就会出现产生不了文件的问题。

     解决方法: 原先使用的方法是:先打开一个文件,当接到数据后,把数据写到这个文件里,再接到再写的过程。等数据完成后,再把文件关闭,这时才产生文件。
     现在的方法更改为:先打开一个文件,当接到数据后,把数据写到文件里,并且关闭文件,这时就会产生文件。而等到再接到数据时,再打开这个文件,再写入,再关闭。
     当更改为后一种后,就不再出现这个问题了。 

第二:程序完成后,在本机可以运行,但是在别的机器上时,出现Run Time Error '429'错误。即ActiveX部件不能创建对象。
     
     这个问题是由于Winsock.Ocx控件本身的问题产生的,原因是目标计算机失去了注册信息。


The error occurs because the target computer is missing the license information for the control objects that are used in the application. You might attempt to set the project reference to point to MSWINSCK.ocx, and then generate a deployment package through the use of the Package and Deployment Wizard. This would generate a setup package that contains the correct version of the Winsock control. However, the license key for the control will not be compiled into the application unless an instance of the control is placed on a form. When you try to instantiate the objects at run time, the application has no way to provide the license key, and the code will fail. For example, the following code will run properly at design time, but will fail at run time on computers that do not have Visual Basic installed:

Dim myWinSock As MSWinsockLib.WinsockSub Main()' Early binding does not workSet myWinSock = New MSWinsockLib.WinsockmyWinSock.LocalPort = 5432myWinSock.ListenMsgBox ("Listening!")myWinSock.CloseEnd Sub

通过,下面这种方法,就可以解决这个问题。
Therefore, you must provide an instance of the Winsock control on a form so that Visual Basic can compile the license information into the application. You can make the form hidden if necessary. To do this, set the form's Visible property to "False." You can then prepare for deployment. The following code snippet demonstrates the method:

Dim myWinsock As MSWinsockLib.WinsockSub Main()' Form1 is hiddenSet myWinsock = Form1.myWinsockmyWinsock.LocalPort = 5432myWinsock.ListenMsgBox ("Listening!")myWinsock.CloseEnd Sub

2005年11月14日 10:49