InstallShield makes installation software with ODBC

xiaoxiao2021-03-06  38

The project is getting close to the end, always gives you a beautiful wedding dress. I chose InstallShield 6.22 to make installation software with an ODBC database, INSTALLSHIELD can be said to be the best production tool for software installation. Less nonsense, let us work together! First, create a Standard Setup Project with InstallShield's Project Wizard, as shown in Figure 1 Enter the project name, application name, company name, version number, select your own executable, choose the next step.

Figure one step one

Select the language in the STEP2 of the wizard, continue to press Next as shown in Figure 2:

Figure 2 Step 3

The MAIN APP will include executable files, dynamic connection libraries, etc. Files, Tutorial is a help file package, examples is an example package, you can add the above file, continue next, until completion. Of course, you can join your needs files in the middle. The middle step is not tapapperated, so a setup is "Do", of course this installer is just a null, and cannot access the database. Let's take a look at how to register a database. Open the project already made, we can see the picture shown in Figure 3, where the right includes File Groups, Resources, MEDIA, SCRIPTS, Compenens, Step Types, Setup Files,

Figure three INSTALLSHIELD

First, select File Groups, as shown in Figure 4, add the executable to be packaged in Static File Links, your * .mdb database file, dynamic connection library, also include the help file you need, and icon (ICO), etc.

Figure 4

Then select Resources to change the reality text of the installation screen. As shown in Figure 5, title_main is the installer background display text, etc., you can change any.

Figure 5 Add Install Background Text

Then add an ODBC3.51 object to CompeNents to run files, configure the database, and set up the target machine to set up the ODBC, as shown in Figure 6

Figure 6 Data formation added

Finally, Luo is finished, and then select Script to see the program. The installshield main program structure is usually started with Program, and his EndProgram ends, he is equivalent to the main main port function in the C language, but in InstallShield6.22, we look Only two functional functions: onfirstuibefore, onmoving to handle the installation process, in fact, his main function has been packaged by installsheild, so we have to add the effect we need to be modified as long as it is modified in these two functions. The ONFirstuibeFore is mainly used to control the installation process, and onMoving is mainly used to control the display effect. First we set up the background color of the installation, and the source code is added behind the BEGIN of the onfirstuibefore function, in the program as follows:

Settitle (@title_main, 24, white); // Setting the background display text settitle (@title_captionbar, 0, backgroundcaption); // Installation Start prompt software name enable (fullwindowmode); // Background full screen enable (Background); // Show background setColor (Background, BK_BLUE | BK_SMOOTH); // Background Color For blue gradients with a background, you have to add a lock to your own program - add a serial number, first we add a variable declaration of the onfirstuibefore function. Integer number ncount; use to record the number of input serial numbers, then add code after DLG_SDREGISTERUSEREX in the onfirstuibefore function: ....... DLG_SDREGISTERUSEREX: SZMSG = ""; sztitle = ""; nresult = SDREGISTERUSEREX (Sztitle, Szmsg, szname, szcompany, szserial; if (nresult = back) goto DLG_SDSHOWINFOLIST; / / Enter the serial number! IF (SZSERIAL! = "123123") && (Ncount <3) Then ncount = ncount 1; MessageBox ("Enter the serial number is incorrect, please re-enter!", information); goto DLG_SDREGISTERUSEREX; Endif; if ncount = 3 Then MessageBox ("Input has been used for more than three times, please install it after the serial number!", Information; Abort; Endif; // Serial number verification ... Finally, we must register in the database, to make clear the establishment of the database The change of the table, first create a DRIVE DO Microsoft Access (*. Mdb) for the DRIVE DO Microsoft Access (*. Mdb) in the control panel, then let's take a look at the changes in the registry and enter the starting run. Regedit enters the registry, S-1-5-21-796845957-606747145-83957-606747145-839522115-500 odbc.ini discovers the data source we have just established, select the item , Appear in the right side of the registry, a few key values ​​shown in Figure Seven:

Figure seven registry key

The first item does not need to be set, we start DBQ from the second item, he is the location of the database (* .mdb); the third key value is the establishment of Access, the general system contains this dynamic connection library; the fourth is The driver flag is a hexadecimal 19; the fifth describes the type of ODBC data source is Microsoft's Access; the sixth is that the safety flag is generally 0; the seventh is that the user ID is not considered empty. Ok, we now clear the registry mechanism, then we can delete our hand-built data sources, because our will use the program to realize the registration of the database, join the code in front of the RETURN 0 of the onfirstuibefore function, as follows:

... // Registry Registration RegdbsetDefault (HKEY_CURRENT_USER); if (RegdbKeyexist ("Software // ODBC // ODBC.INI // OIL") <0) THEN IF ("Software // ODBC // Odbc.ini ") <0) THEN IF (" Software // ODBC ") <0) The RegdbcreateKeyex (" Software // ODBC ",", "); ENDIF; RegdbcreateKeyex (" Software // ODBC // ODBC. INI "," "); Endif; RegdbcreateKeyex (" Software // ODBC // ODBC.INI // OIL "," "); Else RegdbdeleteKey (" Software // ODBC // ODBC.INI // OIL "); RegdbcreateKeyex ("Software // odbc // odbc.ini // il", ""); ENDIF; if ("Software // ODBC // Odbc.ini // ODBC Data Sources") <0) Then RegdbcreateKeyex (" Software // ODBC // Odbc.ini // ODBC Data Sources "," "); Endif; RegdbsetKeyValueex (" Software // ODBC // ODBC.INI // Oil "," DBQ ", Regdb_String, Targetdir " // Data //se.mdb ", -1); RegdbsetKeyValueex (" Software // ODBC // ODBC.INI // OIL "," Driver ", Regdb_String, Winsysdir " // odbcjt32.dll ", -1); RegdbsetKeyValueEx (" Software // odbc // odbc.ini // il "," fil ", regdb_string," ms access; ", -1); regdbsetKeyValueex (" Software // ODBC // ODBC.INI // O IL "," uid ", regdb_string," ", -1); RegdbsetKeyValueex (" Software // ODBC // ODBC.INI // OIL "," driverid ", regdb_number," 25 ", -1); RegdbsetKeyValueex (" Software // odbc // odbc.ini // il "," Safetransactions ", Regdb_Number," 0 ", -1); RegdbsetKeyValueex (" Software // ODBC // ODBC.INI // ODBC Data Sources "," OIL " , Regdb_String, "Driver do Microsoft Access (* .mdb)", -1); ... huh, the rest is to create a shortcut on the desktop. We join:

转载请注明原文地址:https://www.9cbs.com/read-70244.html

New Post(0)