Many of the installer user use FileService and Win32RegistrySerives in their custom codes. Although InstallAnywhere provides support for putting and retriving Registry entries at the software install location but some times it becomes a complsion for the installer auother to use these services in their custom code.
In order to use FileService in you custom code you need to activate support for File Service in your project. This can be checking the property in Project-->>Java-->> Check the radio button saying "Add File Service support"
This would enable your project to over take File Service of the operating system. While developing the project add IAClasses.zip, services.jar, win32ppk.jar file to your project. IAClasses.jar file is present in the resources folder of your $IA_HOME services.jar will be found inside servises folder of Resources folder. Win32ppk.jar present in the OS specific folder under services.
FileServices interface and Win32RegistryService interface is present in Services.jar and win32ppk.jar respectively which are hidden for new InstallAnywhere users as they are aquinted of using IAClasses.zip files in their project.
When developing the custom code implement the FileService and Win32RegistryService interfaces in your project. I am putting an example below on how to implement the custom code, it will help the new users for using Registry and FileService
package com.mycompany.project
import com.zerog.IAClasses.*;
import com.installshield.FileServices.*;
import com.installsheild.RegistryService.*;
public myClass extends CustomCodeAction
{
public void install(InstallerProxy proxy) throws InstallException
{
String install_path = proxy.substitute("$USER_INSTALL_DIR$");
FileService fs = (FileService)proxy.getService(FileService.class);
// Now you will be able to use all the methods in FileService
fs.mkdir(install_path+"\\bin");
win32RegistryService reg = (win32RegistryService)proxy.getService(win32RegistryService.class);
/* Now you can use the methods exposed by Win32RegistryServices */
}
public void uninstall(UninstallerProxy Uproxy) throws InstallException
{
// @@TBD
}
}
The above code snippet will explain the basic usage of FileService and Win32RegistryService in Custom code.
As a matter of practice it is always advisable to use the actions provided inside the Advanced designer of InstallAnywhere, as the custom code maintenance and writing is costlier. Always refer to your installer design before deciding on the usage of InstallAnywhere Custom Code.
If you require any clarification on the topic feel free to write mailto:jha.yogi@gmail.com
No comments:
Post a Comment