next up previous contents
Next: FFish Script Objects Reference Up: Tutorials Previous: Using shared objects in   Contents

Using autoupdate

The autoupdate feature is implemented in the "AutoUpdate.dll" that can be called in SWFKit or SWFKit Pro. In SWFKit Pro you can use the Dll object to call the functions exported by the "AutoUpdate.dll". The first thing you would have to do is to add the "AutoUpdate.dll" into the resources list. The "AutoUpdate.dll" file is in the SWFKit installed folder, typically, it is "c:\program files\swfkit pro 3".
var autoupdate = getAdditionalFile("AutoUpdate.dll");
dllimport autoupdate stdcall void AutoUpdate_Check(char*, char*, Boolean);
dllimport autoupdate stdcall void AutoUpdate_UICheck(char*, char*);
The AutoUpdate_Check function is used to search for an update at the background. That is to say, it does not display a wizard. The first parameter of this function is the url of the ini file created by the UpdateMaker, the second parameter is the name of your application, and the third parameter is used to determine whether the function will be called silently. The function is called silently means that if there is no update found, it will do nothing. If the parameter is set to false, it will display a message box to say that there is no new update. If a new update has been found, it will display a message box even if it is set to run silently.
AutoUpdate_Check("http://www.mysite.com/updata/update.ini",
    "My Application", true);
Adding the above code to the "initialize" script will let your application check the update silently when it is launched.

You can also let your application explicitly check the update by calling the "AutoUpdate_UICheck" function, it will display a wizard for you to search for new updates.

AutoUpdate_UICheck("http://www.mysite.com/updata/update.ini",
    "My Application");

In SWFKit, you cannot call dll functions. However, the "AutoUpdate.dll" exports an ActiveX component to search for new updates. First, you should add the "AutoUpdate.dll" into the resources list and register it. The "AutoUpdate.dll" file is in the SWFKit installed folder, typically, it is "c:
program files
swfkit 3". The ActiveX components exported by "AutoUpdate.dll" contains the following methods and properties:

updateINI The ini file produced by the UpdateMaker

appName The name of your application

Check(bSilent) Check whether there is a new update. If bSilent is set to true, this method will search for the new update silently, that is, if there is no new update, it will do nothing; otherwise, it will display a message box to say that there is no new update. If a new update is found, it will display a message box even if bSilent is set to true. This function does not display a wizard. So you can call this method in the "initialize" script to check the updates silently.

UICheck This method is used to check updates explicitly. It will display a wizard.

var autoupdate = getAdditionalFile("AutoUpdate.dll");
ActiveXObject.register(autoupdate);
var ax = new ActiveXObject("AutoUpdate.SWFKitAutoUpdate");
ax.updateINI = "http://www.mysite.com/update/update.ini";
ax.appName = "Test Plug-in";
ax.check(true);


next up previous contents
Next: FFish Script Objects Reference Up: Tutorials Previous: Using shared objects in   Contents
Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.