VC ++ package (InstallShield)

Source: Internet
Author: User

1. Generate a release for the completed program, and then click tools --> InstallShield wizard. (if there is no such release, you can find the installation disk of vc6. find the ishield file and setup.exe to install InstallShield.) The InstallShield user interface is displayed.

2 The following describes how to use InstallShield

1. Select scripts from the options on the left.

This is the core part of all production, and it is also the best thing we should focus on. Of course, you can create a standard installer without changing the source program in scripts. However, if you can control scripts programming, the creation level of the entire installer can reach a new height, this may be the beginning of the difference between you and an ordinary producer. In fact, InstallShield scripts is very similar to C and C ++ programming, I believe it is very easy for most programmers to master. For friends who have no basic knowledge of C and C ++, after reading this article, I believe you can also make your own scripts well, because it is quite repetitive, it is easier to draw images based on Huludao.

The scripts layout is very similar to the C language. The first is the inclusion of the header file, followed by the definition of the string, the original description of the function, and the description of global variables. You can add your function description and global variable description here.

Scripts follows the c Rule and also has local variables and definitions. According to the C ++ annotation rules, you can use the // annotation content for single line annotation, or you can use/* annotation content */to annotate a statement. All keywords and macro definitions are marked in different colors, which is very intuitive. Scripts programming follows the idea of Structured Programming and provides a large number of function libraries similar to Windows APIs for calling. Each macro definition has a detailed description, in addition to explaining the meaning of each variable, corresponding examples are attached. These instructions and examples can help new users get on the road in a very short period of time. For those who have developed Windows programs using VC ++, it is simply a 6 = 2 × 3 change that can be easily mastered.

At the beginning of the program, it is program ..................... Endprogram, which is equivalent to main () {……} in C (){......} Main function. The programs of sub-function bodies are arranged in the order of calls. All functions are easy to understand and do not need to be changed. The following describes several frequently-used and frequently-modified functions.

(1) function setupfolders ()

Function setupfolders ()

Number nresult;

String szfolderdir;

Begin

Szprogramfolder = folder_programs ^

Shell_object_folder; // specifies the location where a program group or shortcut is created.

Szitemname = "eye image multi-function processing system"; // Application name

Szprogram = targetdir+'eye95.exe '; // Executable File Name

Szparam = "";

Longpathtoquote (szprogram, true); // merge path

Longpathtoshortpath (szparam); // converts it to a short path, which is used for win31 and winnt3.5.

Szcommandline = szprogram + "" + szparam; // generate command line

Szworkingdir = targetdir; // working path

Sziconpath = "";

Nicon = 0;

Szshortcutkey = "";

Nflag = replace;

Addfoldericon (szprogramfolder, szitemname,

Szcommandline,

Szworkingdir, sziconpath, nicon,

Szshortcutkey, nflag );

Szprogramfolder = folder_desktop;

Longpathtoquote (szcommandline, true );

If (sprintfbox (OK | cancel, "select:", "% s", "Do you want to create a shortcut on the desktop? ") = 6)

Then

Addfoldericon (szprogramfolder, szitemname, szcommand

Line,

Szworkingdir, sziconpath, nicon, szshortcutkey,

Nflag );

Endif;

Szprogramfolder = folder_programs ^ shell_object_folder;

Szitemname = "readme ";

Szprogram = WINDIR ^ "notepad.exe ";

Szparam = targetdir ^ "readme.txt ";

Longpathtoquote (szprogram, true );

Longpathtow.path (szparam );

Szcommandline = szprogram + "" + szparam;

Addfoldericon (szprogramfolder, szitemname,

Szcommandline,

Szworkingdir, sziconpath, 0,

Szshortcutkey, nflag );

Nresult = createshellobjects ("");

Return nresult;

End;

In fact, this program is simply an application of addfoldericon. Use addfoldericon to add a program group, program item, or shortcut to the desktop in the Start Menu. Therefore, it is necessary to read the description of addfoldericon first. It has eight entry parameters. The first parameter szprogramfolder is used to determine the position (PATH) of the menu to be added to Win95. For example

"C:/Windows/startmenu/programs/accessories/Games ".

In Windows 95 and winnt4.0, you can also use the system macro definition: folder_desktop (added to the desktop) and folder_desktop (added to the Start Menu), folder_programs (added in the Start-> program menu), and so on. The second parameter is szitemname, that is, the name of the added icon (Application name ). The third parameter szcommandline is relatively cumbersome. It specifies the executable program and its command line, or the full path under the subdirectory (only applicable to Windows95 & winnt4.0 ). Szworkingdir is the working path, which can be null: "" Or targetdir (target path ). Sziconpath is the icon path, which is generally set to NULL: "". Nicon indicates the number of icons. If an application has several icons, the number of icons to display is 0, 1, 2 .......

Szshortcutkey is used to define the shortcut key. Nflag is used to specify the icon appearance. If the path contains a long path name, you must use ''or 'to include the long path name, and then use the longpathtoquote function to merge it. When it is used for 16-bit win31 and winnt3.5, you should also call longpathtow.path for conversion. In this way, you can create a program group, program item, or shortcut. Too troublesome? It doesn't matter. If you think this operation is really troublesome, you can skip it and complete it in resource. For details, refer to it later.

(2) function setupscreen ()

Begin

Enable (fullwindowmode );

Enable (indvfilestatus );

Settitle ("Ophthalmology multi-function processing system installer", 28, yellow); // modify the font and color

Settitle ("Ophthalmology multi-function processing system", 0, backgroundcaption); // The font and color of the title line

Enable (background );

Delay (1 );

End;

Here we mainly use the settitle (szstring, npointsize, ncolor) function.

The three parameters represent the content, font size, and color of the Written string.

(3) function dialogshowsdwelcome ()

Number nresult;

String sztitle, szmsg;

Begin

Sztitle = "welcome ";

Szmsg = "welcome to the multi-function processing system installation program for ophthalmology! ";

Nresult = sdwelcome (sztitle, szmsg );

Return nresult;

End;

Write the title of the program you want to create in this function.

(4) function setupregistry ()

Number nresult;

String szkey, sznumname, sznumvalue, svnumvalue;

Number ntype, nsize;

Begin

Szkey = "Robert/Robert tsoftware/spirit/version"; // your primary key

Sznumname = "testvalue"; // key name

Sznumvalue = "12345"; // key value

Ntype = regdb_number; // type

Nsize =-1; // specify the size

Regdbsetkeyvalueex (szkey, sznumname, ntype, sznumvalue, nsize); // create

Nresult = createregistryset ("");

Return nresult;

End;

Using this method to modify the registry, coupled with some algorithms, you can invest a small amount of time but play a very good role in encryption. You may wish to try it! ?

(5) function dialogshowsdfinishreboot ()

Number nresult, ndefoptions;

String sztitle, szmsg1, szmsg2, szoption1, szoption2;

Number bopt1, bopt2; begin

If (! Batch_install) then

Bopt1 = false; // No

Bopt2 = false; // No

Szmsg1 = "% P installation is complete! "; // % P indicates the name of the installer.

Szmsg2 = "press the end key to end the installation of % P. "; // Prompt information

Szoption1 = "I want to see the README file. ";

Szoption2 = "I want to run the program now. ";

Nresult = sdfinish (sztitle, szmsg1, szmsg2,

Szoption1, szoption2, bopt1, bopt2 );

If (bopt1) then

Launchappandwait (WINDIR ^ "notepad.exe", targetdir ^ "readme.txt", wait); // if selected, call the Windows notebook to load the README file.

Endif; If (bopt2) then

Launchapp(targetdir+'eye95.exe ', ""); // if selected, immediately execute the application

Endif;

Return 0;

Endif;

Ndefoptions = sys_bootmachine;

Sztitle = "";

Szmsg1 = "";

Szmsg2 = "";

Nresult = sdfinishreboot (sztitle, szmsg1,

Ndefoptions, szmsg2, 0); // determines whether to restart the computer.

Return nresult;

End;

This program is installed to the end, prompting you to check the self-report file, whether to start the program immediately, and whether to restart the computer.

The five most needs to be modified in scripts. Others are modified based on the producer's own needs.

* ***** Note that after each modification, the compilation (complie) is correct. Otherwise, the expected functions cannot be implemented.

Ii. Modify file groups

Double-click examples files, help files, program DLLs, program executable files, and shared DLLs. In the corresponding links, right-click and you can insert a group of files, a folder, or a file. Files are added to examples files, help files, program DLLs, program executable files, and shared DLLs to install the program. A simpler method is to start launch explorer in tools and drag the required files or folders to the blank area on the right.
3. Modify Components

Click program files, example files, help files, or shared DLLs, double-click include file groups in the table on the right, and click Add… in the pop-up Properties dialog box ..., Add to the corresponding file group.

4. Modify setup types

Click compact, typical, or M m, and select the corresponding components from the table on the right.

Note: Only two, three, and four operations can you complete the typical installation, simple installation, and customized installation options during installation.

5. Modify setup files

In the splash screen-> language independent, you will find a setup.bmp file, which is a flickering screen provided by the system at the beginning of installation. You can replace this setup.bmp with your seal. In language independent-> operating system independent, you will find license.txtand infolist.txt. You can write the description and copyright information of your application into the corresponding file.

6. Modify Resource

In register entires, you can add your key value. Right-click Register entires and click New entry to add your own key value to the register set on the right.

In Shell objects, two types are available: Explorer Shell and program manager shell, which are designed for windows95, winnt4.0, win31, and winnt3.5 respectively. In Explorer Shell, there are also layers of desktop, Start Menu, programs, and startup. You can right-click on any layer to insert the shortcut or folder you want to add.

Click shortcut or folder, double-click the table option on the right, and fill in the blank items in sequence. The folder or shortcut is created in your ideal destination. Do not rush to press the run Setup tool button, otherwise you will find that what you get after running is not exactly what you designed! This is because you are missing:

7. Run Media Wizard

In the media column, click media build wizard and follow the prompts to execute it step by step until the end of the process (Instead, you only need to press the "Next" button continuously ). You can add more exciting tricks, such: installShield meets your needs. However, you need to be familiar with scripts, which is beyond the control of simple methods.

Now, you can run Setup. How is it? Not professional enough? Cool or cool? Please do not drop your mouth!

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.