⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vcg24.htm

📁 Visual C++与数据库的连接经典实例
💻 HTM
📖 第 1 页 / 共 4 页
字号:

              AddFolderIcon( svGrp, "Example2",

                             szProgram + TARGETDIR ^ "SAMPLES\\LAUNCHER.DBD",

                             TARGETDIR ^ "SAMPLES",

                             "", 0, "", REPLACE );

              Delay( 1 );

           endif;

           AddFolderIcon( svGrp, "ReadmeFile",

                          "NOTEPAD.EXE " + TARGETDIR ^ "README.TXT",

                          TARGETDIR,

                          "", 0, "", REPLACE );

           Delay( 1 );

           szProgram = WINDIR ^ "UNINST.EXE";

           LongPathToShortPath( szProgram );

           LongPathToShortPath( svUninstLogFile );

           AddFolderIcon( svGrp, "Uninstaller",

                          szProgram + " -f" + svUninstLogFile,

                          WINDIR,

                          "", 0, "", REPLACE );

           Delay( 1 );

        endif;

        // Setup complete and readme file

        SetStatusWindow( 100, "Installation complete." );

    // If shared files could not be installed, users must restart system

        if (BATCH_INSTALL = TRUE) then

           szMsg = "Some files could not be installed because they are "+

         "currently in use by other programs in the system.  "+

         "To allow for proper operation of the new program you should restart"+

         "your system at this time.";

      if (RebootDialog( "Restart Windows", szMsg, SYS_BOOTMACHINE ) = 0) then

          // Still must ensure proper installation

          CommitSharedFiles(0);

      endif;

    else

           szMsg = "Setup is complete.  You may run the installed program ";

           if ( bWinNT ) then

              szMsg = szMsg + STR_COMPLETENT;

           else

              szMsg = szMsg + STR_COMPLETE95;

           endif;

           MessageBeep( 0 );

           MessageBox( szMsg, INFORMATION );

        endif;

        exit;

/*-------------------------------------------------------------------------

     Name    : SetupScreen

     Purpose : This function will set up the screen look.  This includes

               colors, fonts, text to be displayed, etc.

-------------------------------------------------------------------------*/

function SetupScreen()

        begin

          Enable( DEFWINDOWMODE );

          Enable( INDVFILESTATUS );

          SetTitle( APP_NAME + " Setup", 36, WHITE );

          SetTitle( "Setup", 0, BACKGROUNDCAPTION );  // Caption bar text

          Enable( BACKGROUND );

        end;

//-------------------------------------------------------------------------

//

//   Name    : CheckRequirements

//

//   Purpose : This function will check all minimum requirements for the

//             application being installed.  If any fail, the user

//             is informed and the installation is terminated.

//

//-------------------------------------------------------------------------

function CheckRequirements()

          number  nvDx, nvDy;

          number nvResult;

          STRING szResult;

        begin

          // --- Determine if NT or Windows 95 not --

          GetSystemInfo( WINMAJOR, nvResult, szResult );

          bWinNT = TRUE;

          if (nvResult = 4) then

             bWinNT = FALSE;  // Running Windows 95

          endif;

          // --- Check screen resolution ---

          GetExtents( nvDx, nvDy );

          if (nvDy < 480) then

      MessageBox( "This program requires VGA or better resolution.", WARNING );

             exit;

          endif;

        end;

//-------------------------------------------------------------------------

//

//   Name    : CheckSpaceRequirements

//

//   Purpose : This function will check space requirements based on the

//             elements being installed.

//

//-------------------------------------------------------------------------

function CheckSpaceRequirements( bIncludeSamples,

                                 bIncludeProgram,

                                 bIncludeHelp,

                                 szDir )

          number  nSizeRequired;

        begin

          nSizeRequired = 0;

          // Determine total size

          if (bIncludeSamples) then

            nSizeRequired = nSizeRequired + SIZE_REQ_SAMPLES;

          endif;

          if (bIncludeHelp) then

            nSizeRequired = nSizeRequired + SIZE_REQ_TEMPLATES;

          endif;

          if (bIncludeProgram) then

            nSizeRequired = nSizeRequired + SIZE_REQ_PROGRAM;

          endif;

          // Space check of target drive

          bSpaceOk = TRUE;

          if (GetDiskSpace( szDir ) < nSizeRequired) then

          szMsg = "There is not enough space available on the disk\n" +

                 "'" + svMainDirectory + "' \n" +

                 "Please free up some space or change the target location\n" +

                 "to a different disk";

             MessageBeep(0);

             MessageBox( szMsg, WARNING );

             bSpaceOk = FALSE;

          endif;

          return bSpaceOk;

        end;

//-------------------------------------------------------------------------

//

//   Name    : CreateRegDBEntries

//

//   Purpose : This function will create necessary keys and values for

//             the sample program.

//

//-------------------------------------------------------------------------

function CreateRegDBEntries()

        string szKey[255], szValue, szDemo, szProgram;

begin

        // Create PRODUCT_KEY key

        szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +

                PRODUCT_VERSION + "\\" + "DESIGNER";

        RegDBCreateKeyEx( szKey, "" );

        RegDBSetKeyValueEx( szKey, "Template", REGDB_STRING, "good.tpl", -1 );

        RegDBSetKeyValueEx( szKey, "TemplatePath", REGDB_STRING,

                      svMainDirectory ^ "TEMPLATE", -1 );

        if (bIncludeSamples) then

           // Create "DEMOS" key

           szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +

                   PRODUCT_VERSION + "\\" + "DEMOS";

           RegDBCreateKeyEx( szKey, "" );

           szDemo    = svMainDirectory ^ "PROGRAM\\MULTI.DBD";

           szProgram = svMainDirectory ^ "PROGRAM\\DEMO.EXE";

           RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, szDemo, -1 );

           RegDBSetKeyValueEx( szKey, "exe0", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active0", REGDB_STRING, "Play", -1 );

           szDemo    = svMainDirectory ^ "SAMPLES\\LAUNCHER.DBD";

           szProgram = svMainDirectory ^ "PROGRAM\\DEMO.EXE";

           RegDBSetKeyValueEx( szKey, "path1", REGDB_STRING, szDemo, -1 );

           RegDBSetKeyValueEx( szKey, "exe1", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active1", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe2", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active2", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe3", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active3", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe4", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active4", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe5", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active5", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe6", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active6", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe7", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active7", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe8", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active8", REGDB_STRING, "Play", -1 );

           RegDBSetKeyValueEx( szKey, "exe9", REGDB_STRING, szProgram, -1 );

           RegDBSetKeyValueEx( szKey, "active9", REGDB_STRING, "Play", -1 );

        endif;

        // Create "HELPMENU" key

        szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +

                PRODUCT_VERSION + "\\" + "HELPMENU";

        RegDBCreateKeyEx( szKey, "" );

        RegDBSetKeyValueEx( szKey, "MaxNum", REGDB_NUMBER, "1", -1 );

        RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, svMainDirectory ^

                                          "README.TXT", -1 );

        RegDBSetKeyValueEx( szKey, "exe0", REGDB_STRING, "NOTEPAD.EXE", -1 );

        RegDBSetKeyValueEx( szKey, "active0", REGDB_STRING, "Read Me", -1 );

end;</FONT></PRE>

<P>Even though SETUP.RUL is a long file (more than 500 lines), it's well-documented and logical. You should have little difficulty modifying this file to suit your purposes.

<BR>

<P>The packing list file, shown in Listing 24.3, is much shorter. Like the SETUP.INS file, the packing list file must be processed (using the PACKLIST.EXE program) and placed on the first disk of your product's distribution disk set.

<BR>

<P>

<FONT COLOR="#000080"><B>Listing 24.3. PACK.LST: The packing list input file.</B></FONT>

<BR>

<PRE>

<FONT COLOR="#000080">1;

..\disk1\data.z</FONT></PRE>

<P>In this example, the application's files will fit on a single disk, so there is only one source file for Setup to process.

<BR>

<BR>

<A NAME="E68E126"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Using InstallSHIELD Professional</B></FONT></CENTER></H3>

<BR>

<P>The documentation from InstallShield Corporation refers to the InstallSHIELD Professional version as InstallSHIELD PE. This chapter uses the same designation. InstallSHIELD PE is very much an expanded version of InstallSHIELD SE. The Professional version covers more operating systems, including Windows 3.x, Windows 95, Windows NT, and OS/2.

<BR>

<P>InstallSHIELD PE offers the following features:

<BR>

<UL>

<LI>The capability to create a single installation system that includes Windows 3.1, Windows 32s, 32-bit Windows 95, and 32-bit Windows NT 3.5

<BR>

<BR>

<LI>A complete set of installation templates

<BR>

<BR>

<LI>More than 50 built-in user interface objects and complete customization of all objects in InstallSHIELD PE

<BR>

<BR>

<LI>The ability to integrate your own custom dialog boxes

<BR>

<BR>

<LI>The InstallSHIELD Visual Debugger, a Windows hosted debugger designed specifically for installation building and testing

<BR>

<BR>

<LI>The ability to use your company logo, corporate look, animated bitmaps, and billboards during installation

<BR>

<BR>

<LI>The ability to selectively install components of a multicomponent application

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -