function ProcessBeforeDataMove() STRING svLogFile; NUMBER nResult;begin // Create app information, uninstallation, and App Paths registry keys. InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY ); svLogFile = UNINST_LOGFILE_NAME; nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 ); if (nResult < 0) then MessageBox( @ERROR_UNINSTSETUP, WARNING ); endif; szReferenceFile = svDir ^ "MyApp.exe"; DeinstallSetReference (szReferenceFile); szReferenceFile = svDir ^ "MyApp.dll"; DeinstallSetReference (szReferenceFile); szAppPath = TARGETDIR; // TO DO : if your application .exe is in a subfolder // of TARGETDIR then add subfolder if ((bIs32BitSetup) && (bIsShellExplorer)) then RegDBSetItem( REGDB_APPPATH, szAppPath ); RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY ); RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME ); endif; // TO DO : any other tasks you want to perform before file transfer return 0; end;
在调用deinstallsetreference之前,函数CreateInstallationInfo(或InstallstionInfo)和MaintenanceStart(或DeinstallStart)是必须要被调用的。这几个函数具体意思可以在Installshield帮助中的索引中查得用法。有一点要说明的是,如果安装程序是基于事件的(InstallShield6.x产生的脚本),这几个函数是会自动调用的,如果一旦自动调用,那么Deinstallsetreference函数就无法执行了。(帮助中" The following script is in the procedural format used in previous versions of InstallShield Professional"写的很清楚:)要用的话,我的方法是写类似于InstallShield5.x那样的脚本(program......endprogram等等),所有信息和步骤都由自己编写,那么Deinstallsetreference就可以使用了(会很累......)。所以说在InstallShield6.x版本中,我常常是对要判断的程序文件进行改名操作,如果成功,就说明程序不在运行,改回来就是了,如果不能改,则说明程序在运行。这样即方便也容易,安全性也不差的。
DeinstallSetReference (szReferenceFile); szReferenceFile = svDir ^ "MyApp.dll"; DeinstallSetReference (szReferenceFile);
STRING svLogFile;
NUMBER nResult;begin // Create app information, uninstallation, and App Paths registry keys. InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY ); svLogFile = UNINST_LOGFILE_NAME; nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
if (nResult < 0) then
MessageBox( @ERROR_UNINSTSETUP, WARNING );
endif; szReferenceFile = svDir ^ "MyApp.exe";
DeinstallSetReference (szReferenceFile); szReferenceFile = svDir ^ "MyApp.dll"; DeinstallSetReference (szReferenceFile);
szAppPath = TARGETDIR; // TO DO : if your application .exe is in a subfolder
// of TARGETDIR then add subfolder if ((bIs32BitSetup) && (bIsShellExplorer)) then
RegDBSetItem( REGDB_APPPATH, szAppPath );
RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
endif; // TO DO : any other tasks you want to perform before file transfer return 0;
end;
InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY 的参数应怎么取得啊?
我从来没用过谢谢。
: )
在Installshield里FindWindow可以接受两个参数,一个就是程序对话框的类,另一个就是对话框的名字。第一种,好是好可很麻烦,因为我们可能很难得知类的名,比如说Word的对话框,我找了很久也找不到;第二种,名的方法局限性更大了,还是用Word举例,Word打开不同的文件,其对话框名都是不一样的。写函数的方法,添加一个过程,手动调用的方法,对于懒散的我来说有些麻烦,不过既然有现成的范例可供改写,那下次我也这么干:")