Setupfactory for program Packaging

Source: Internet
Author: User

By: gisbreeze)

Recently, I have been working on program packaging. I have learned from the Internet and downloaded more than N packaging programs. Although many of them are being introduced one by one, they finally tend to be mainstream, select the setupeproject, install shield, and setupfactory that comes with vs2005 as the main direction.
1. setupeproject included in vs2005
Advantages: The functions are basically complete, and many user-defined functions are provided. The reading and setting of registry and system files have regular rules and access formats; because it is directly established in Vs in the form of a project, you can build the program code to perform the installation operations you want, such as the installation process, uninstall, and so on, including the form, and in a solution, its DLL and other dynamic links are dynamically updated.
Insufficient: the UI beautification is not good enough, and the custom function of the installation interface interaction is not powerful enough. In addition, it is encapsulated by itself. the management of net framwork and dependence does not have the parameter option settings, so it is not easy to use.
Ii. Install Shield
I found n more from the Internet, but there was no place to download. It seems that this software is good at combating piracy, so I had to give up.
Iii. setupfactory7.0
Almost all of his operations are graphical and have the following features:
1. Wizard-based project creation, which is convenient and convenient.
2. Supports various themes to make your installation programs more personalized, and these themes are very beautiful;
3. Automatic inclusion and uninstallation of programs without separate work;
4. controls can be registered as COM components in file properties, which is convenient and useful;
5. Supports custom uninstallation programs;
6. Script running is supported in the installer;
7. You can customize a set of serial numbers and set the software expiration control;
8. Multiple installation methods are supported. You can set custom, maximum, and minimum installation methods;
9. Supports installation in multiple languages;
10. Multiple installation modes are provided, including a single Web file, CDROM, and floppy disk;

Its functions are really quite powerful. At the very least, the interface design and user interaction save a lot of effort, and its support for script operation (like VB ), make it more like a small development platform. By writing scripts by yourself, running them during the installation process, and combining their existing functions, you can do anything. The following are some of the more practical questions I have come across:

(1) read the registry:

All are used as static functions in the Registry class, including get (), set (), dosekeyexisit (), createkey (), etc, the path format for reading the Registry adopts the normal path ACCESS format, as shown in the test. network 2.0 is installed with net = registry. doeskeyexist (HKEY_LOCAL_MACHINE, "software // Microsoft //. network // policy // V2.0 "); check whether MDAC is installed with MDAC = registry. get (HKEY_LOCAL_MACHINE, "software // Microsoft // dataaccess", "version", true );
I added a checkbox form to check whether the system has installed arcgisengineruntime, dotnetframwork, and MDAC, and then set check based on different situations. The Code is as follows:
<! -- Put in the form on prload -->
Engineruntime = registry. Get (HKEY_LOCAL_MACHINE, "software // ESRI // ArcGIS Engine RunTime", "realversion", true );
Net = registry. doeskeyexist (HKEY_LOCAL_MACHINE, "software // Microsoft //. Network // policy/V2.0 ");
MDAC = registry. Get (HKEY_LOCAL_MACHINE, "software // Microsoft // dataaccess", "version", true );
Tcheckproperties1 = dlgcheckbox. getproperties (ctrl_check_box_01); -- read checkbox01
Tcheckproperties2 = dlgcheckbox. getproperties (ctrl_check_box_02 );
Tcheckproperties3 = dlgcheckbox. getproperties (ctrl_check_box_03 );
If (engineruntime = "9.2") then
Tcheckproperties3.enabled = false;
Tcheckproperties3.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_03, tcheckproperties3); -- set the status of checkbox01
Else
Tcheckproperties3.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_03, tcheckproperties3 );
End
If (net) then
Tcheckproperties1.enabled = false;
Tcheckproperties1.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_01, tcheckproperties1 );
Else
Tcheckproperties1.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_01, tcheckproperties1 );
End
Numtemp = string. Left (MDAC, 3); -- truncates the first three characters in the string value MDAC (2.81.11133 ).
Nummdac = string. tonumber (numtemp); -- convert the character value to a number
If (nummdac> = 2.6) then
Tcheckproperties2.enabled = false;
Tcheckproperties2.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_02, tcheckproperties2 );
Else
Tcheckproperties2.checked = true;
Dlgcheckbox. setproperties (ctrl_check_box_02, tcheckproperties2 );
End

(2) install system components during installation:
In fact, some of the previous functions of reading the Registry are for this service. First, we know that the software environment is not installed in the system, and then install the software selectively. In the design and installation process, this step should be designed before the user information after the home page, to prevent users from being separated from the installation process without integrity, it should also be clear that it is necessary to install the software environment in the early stage.
Here, it is easy to confuse the program source when package the Environment program into the installer, which has the initial files in the archive, external, and "resource" respectively, that is, the original files, archive files must be installed in the target program directory. External packages can be released to the specified directory,Only the initial files in the resource are temporarily releasedTempfolderRunning and self-clearing,We also need to use this storage method.
Then, we add the corresponding code to the checkbox screen. If the code is not installed, it will be self-installed if it is selected by the user. Then you can write it as "_ templaunchfolder..." // dotnetfx.exe "". At this time, you need to determine whether the program has been executed to continue the next step, such as executing the next external program. In this way, we need to use the loop Statement by adding the "Repeat... "Until not loop" to carry out the conditional loop, and then add operation file. isinuse in the loop to read the program running status.

<! -- Put in the form on next -->
Tproperties1 = dlgcheckbox. getproperties (ctrl_check_box_01 );
Tproperties2 = dlgcheckbox. getproperties (ctrl_check_box_02 );
If (tproperties1.checked and tproperties1.enabled) then
Shell. Execute (_ templaunchfolder .. "// dotnetfx.exe", "open", "", "", sw_shownormal); -- run the dotnetfx.exe file in the folder
End
Repeat
Setupend1 = file. isinuse (_ templaunchfolder .. "// dotnetfx.exe"); -- perform the next step only after the end of dotnetfx.exe
Until not setupend1
If (tproperties2.checked and tproperties2.enabled) then
Shell. Execute (_ templaunchfolder .. "// mdac_typ.exe", "open", "", "", sw_shownormal );
End
Repeat

Setupend2 = file. isinuse (_ templaunchfolder .. "// mdac_typ.exe ");
Until not setupend2
-- Enter the next Screen
Screen. Next ();

(3) establish an association with open programs of the specified file type:
First, let's see how txtis associated with notepad.exe (Registry content ):
[Hkey_classes_root/. txt]
(Default) = "txtfile"
[Hkey_classes_root/txtfile]
(Default) = "Text Document"
[Hkey_classes_root/txtfile/defaulticon]
(Default) = % SystemRoot %/system32/shell32.dll,-152
[Hkey_classes_root/txtfile/Shell/Open/command]
(Default) = "notepad.exe
% 1"

Write the above content into the registry to associate the file.
Therefore, a simple method is to write the Registry file. reg, directly execute it to complete file type association, but the problem is uncontrollable, because you do not know which directory your program will be installed in. Therefore, we chose to write scripts.

The script location is written in the "on progress" step in the "installation time" section. In the following script, ". breezegis" is the extension to be associated. "Breezegisfile" is the internal name of the file type stored in the registry. Make sure that you use a unique name so that you do not accidentally overwrite the registry key of other applications.

"Gisbreeze" is the registry key that specifies the icon contained in the file name associated with the file type. ", 0" tells the resource manager to use the first icon index in myprog. EXE. (", 1" indicates the index of the second icon .)
Breezegisfile // shell/Open/command is the registry key of the program that is executed when the resource manager double-clicks the file type. The quotation marks in the command line allow it to correctly process long file names.

-- File type Association
Breezegis = registry. doeskeyexist (hkey_classes_root, ". breezegis ");
If (breezegis) then
Else
Registry. createkey (hkey_classes_root, ". breezegis ");
End
Breezegisfile = registry. doeskeyexist (hkey_classes_root, "breezegisfile ");
If (breezegisfile) then
Else
Registry. createkey (hkey_classes_root, "breezegisfile ");
Registry. createkey (hkey_classes_root, "breezegisfile // defaulticon ");
Registry. createkey (hkey_classes_root, "breezegisfile // shell ");
Registry. createkey (hkey_classes_root, "breezegisfile // shell // open ");
Registry. createkey (hkey_classes_root, "breezegisfile // shell // open // command ");
End

Registry. setvalue (hkey_classes_root, ". breezegis", "", "breezegisfile", reg_sz); -- registration file type
Result = sessionvar. Expand ("% appfolder %"); -- expand the installation path
Registry. setvalue (hkey_classes_root, "breezegisfile", "", "breezegis", reg_sz );
Registry. setvalue (hkey_classes_root, "breezegisfile", "browserflags", 00000008, REG_DWORD );
Registry. setvalue (hkey_classes_root, "breezegisfile", "editflags", 00000000, REG_DWORD );
Registry. setvalue (hkey_classes_root, "breezegisfile // defaulticon", "", result .. "// data // images // icon // gisbreeze. ICO, 0 ", reg_sz );
-- Icon (... is a string connector)
Registry. setvalue (hkey_classes_root, "breezegisfile // shell // open // command", "", result .. "// bin // breezegis.exe", reg_sz );
-- Specifies the program

The last thing I want to talk about is that I want to operate the script well. The help resources provided by the software itself are rich and easy to understand. I always wonder why I can explain the program code in English ?! When can I compile a Chinese system! In addition, the "add operation" and "Add code" functions of setupfactory are quite powerful, providing common code formats, which are user-friendly and practical for small program writing.

P.s. at the end of this article, we will see an article "sf7 is automatically completed in the generated installer. net work installation "post, the author is by writing xml configuration files to install the environment, it feels very powerful, unfortunately, the configuration parameters are too large, difficult to grasp, you can check it out later :)

 

From: http://bbs.esrichina-bj.cn/esri/thread-46117-1-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.