📄 vcg24.htm
字号:
<BR>
<BR>
<LI>The capability for your installation program to launch help files, readme files, and other applications at any time during or after the installation process
<BR>
<BR>
<LI>The capability to intelligently update or modify system files, AUTOEXEC.BAT and CONFIG.SYS, private and system .INI files, and the Windows Registry
<BR>
<BR>
<LI>The capability to call any function in any DLL—including any Windows API—directly from the script
<BR>
<BR>
</UL>
<P>If after using InstallSHIELD SE you find that you need a more powerful and flexible installation program, you can migrate to InstallSHIELD PE. The InstallSHIELD PE product is compatible with InstallSHIELD SE. This means that you can create a simple installation using InstallSHIELD SE, and, as your needs expand, you can easily migrate to InstallSHIELD PE.
<BR>
<BR>
<A NAME="E68E127"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Modifying the CONFIG.SYS and AUTOEXEC.BAT Files</B></FONT></CENTER></H3>
<BR>
<P>You can incorporate Visual C++ binary file instructions and functions in your setup application to read the AUTOEXEC.BAT and CONFIG.SYS files on the recipient's fixed disk to determine whether you need to make modifications to these files so that your application will execute properly. If the user isn't running Windows for Workgroups, you must load SHARE.EXE in order for OLE 2.0, OLE Automation, and data access to operate properly. Thus, you might need to add a SHARE.EXE /L:500 entry to the AUTOEXEC.BAT file. (The parameter reserves DOS environment space for 500 locks, which is sufficient for most applications.)
<BR>
<P>Your setup program must open and manipulate the AUTOEXEC.BAT and CONFIG.SYS files by reading and parsing them. It's important to realize that it's unacceptable to simply add more lines to the ends of these files. Your application must test to see whether the desired command or string is present and then add the string only if it's missing. This addition usually can be done at the end (or beginning) of the AUTOEXEC.BAT and CONFIG.SYS files, but not always.
<BR>
<P>There are few cases with Windows 95 in which you need to work with either the CONFIG.SYS or AUTOEXEC.BAT files. With Windows 95, neither of these files needs to exist, and with Windows NT, neither of these files does exist.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE><B>TIP</B>
<BR>
<BR>Polite setup applications use a message box to advise the user that the AUTOEXEC.BAT and CONFIG.SYS files might need to be altered. Before making any changes to these files, save a copy of the original versions with the FileCopy instruction and advise the user of the names of the backup files. An even more polite approach is to offer the user the option of modifying the existing AUOTEXEC.BAT and CONFIG.SYS files or creating a new set of files that the user can inspect before copying over AUTOEXEC.BAT and CONFIG.SYS.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<BR>
<A NAME="E68E128"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>The CD-ROM AutoPlay Facility</B></FONT></CENTER></H3>
<BR>
<P>Microsoft has added a new feature to Windows 95—the capability to have a program run whenever an AutoPlay-enabled CD is inserted into the CD-ROM drive. This enables software developers who distribute by (or execute from) CD-ROMs to have either the program or an installation routine start whenever the CD-ROM is inserted into the drive. The AutoPlay facility enables "Plug-n-Play" to extend into the software arena.
<BR>
<P>Users benefit from a product that is easy to use. Using CDs under Windows 95 is easy. You can select the property page for a given CD-ROM by right-clicking on the CD in Explorer, as shown later in Figure 24.7.
<BR>
<P>Many users (and developers) have decried the poor interface between CD-ROM-based applications and Windows. With applications created before AutoPlay, the user had to insert a CD-ROM into the drive and enter a command (often, but not always, called setup) to install the product. Many setup programs ran well, but the concept behind CD-ROM-based applications is that the application (and much of its static data) doesn't need to be copied to the computer's local hard disk; instead, it may remain on the CD-ROM. This permits the user to have a large library of CD-ROM-based applications without having to dedicate substantial portions of the hard disk to these CD-ROM applications.
<BR>
<P>With AutoPlay, the following things happen when you insert a CD:
<BR>
<UL>
<LI>AutoPlay-enabled CD-ROMs execute the designated program. This program typically either is a setup program (less optimal) or actually executes the CD-ROM's main program (more optimal).
<BR>
<BR>
<LI>Audio CDs automatically play using the CD Player applet, which is a standard part of Windows 95. CD Player works very much like your home CD player and offers many of the options and features of a typical CD player.
<BR>
<BR>
<LI>All other CD-ROMs behave as they do under Windows 3.x—that is, they do nothing special.
<BR>
<BR>
</UL>
<P>Sometimes users won't want to activate a program (or play an audio CD) automatically. In this case, they can hold down the Shift key when the CD-ROM (or CD) is inserted to disable AutoPlay. This enables the user to perhaps simply do a directory of the CD-ROM, run a different program from the CD-ROM, or otherwise use the CD-ROM.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE><B>NOTE</B>
<BR>
<BR>People tend to believe that if they stick a CD into their computer, it won't have a virus, trojan horse, or other nasty surprise in store. However, it would be wise to treat most CDs with the same care you would give a diskette or a file downloaded from a BBS: Do a virus scan!</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE><B>NOTE</B>
<BR>
<BR>One alternative would be for AutoPlay to display a dialog that gives the user one button to continue the AutoPlay process and another button to kill the process and continue with the task that had focus. With this technique, the user doesn't need to remember to press the Shift key. Microsoft also recommends this technique: A quick-loading splash screen that lets the user abort.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<BR>
<A NAME="E69E293"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using the AUTORUN.INF Files</B></FONT></CENTER></H4>
<BR>
<P>To make AutoRun work, Windows 95 looks at the CD or CD-ROM that the user inserts. If it's an audio CD, the CD Player applet is launched and the CD is played. If the CD-ROM has an AUTORUN.INF file, this file is examined, and the actions specified in the AUTORUN.INF file are followed. (The AUTORUN.INF file is stored in the CD-ROM's root directory.)
<BR>
<P>The minimum necessary AUTORUN.INF file is shown in Listing 24.4.
<BR>
<P>
<FONT COLOR="#000080"><B>Listing 24.4. The minimal AUTORUN.INF file for AutoRun compliance.</B></FONT>
<BR>
<PRE>
<FONT COLOR="#000080">[autorun]
open=filename.exe
icon=filename.ico</FONT></PRE>
<P>Even this minimal AUTORUN.INF file, with only three lines of information, can be expanded. Take a look at each of the options available and what you can use in your AUTORUN.INF files:
<BR>
<UL>
<LI>open=: This line specifies which program is to be executed whenever the user inserts the CD. This program can reside in the same directory as AUTORUN.INF (the CD's root directory) or in any other directory. To specify a subdirectory, use the format
<BR>
<BR>
</UL>
<BR>
<PRE>
<FONT COLOR="#000080">open=<I>subdir1</I>\<I>subdir2</I>\<I>filename</I>.exe</FONT></PRE>
<P>
<UL>
In this example, Windows 95 will search the CD's directory structure and insert the correct drive letter as necessary. When the program specified in the open= line is executed, the current directory isn't changed. Microsoft recommends that a "teaser" application be launched using the open= line. This teaser application might give the user an opportunity to execute the program or do an installation. A more complex teaser program might check to see whether the application has been installed and, if it has, launch the application rather than the installation program.
<BR>
<BR>
<LI>icon=: The icon for the CD is contained in either an .ICO, .BMP, .EXE, or .DLL file. If the file contains more than one icon (the STARmanager application has a number of different icons), you could specify the icon using the following syntax:
<BR>
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">icon=<I>filename</I>.exe,2</FONT></PRE>
In this example, you have specified that the third icon (the icons are zero-based) will be used. Unlike the open= expression, the icon= line doesn't let you use a path. To use a path, you should use the defaulticon= expression, which is discussed next.
<BR>
<BR>
<LI>defaulticon=: The defaulticon= line specifies an icon path. This path is relative to the CD-ROM drive if no drive specification is provided. I strongly recommend that you not use a drive specification. You can't depend on finding any drive at a known location, nor can an application require drives to be at specific places.
<BR>
<BR>
</UL>
<P><B>WARNING</B>
<BR>
<BR>Don't code your programs to expect a C: drive to be present or writeable. There is no guarantee that a computer will have a C: drive, or that it will be accessible to applications. Diskless workstations might have drives that are found at different locations each time the system is started. You must take this into consideration when you're writing your application.
<P>When an AutoPlay-enabled CD is inserted into the CD-ROM drive, the user can right-click the CD's icon and get a menu of choices. If your AUTORUN.INF file has an open= line, the menu that Explorer displays includes the commands shown in Figure 24.7.
<BR>
<P><B><A HREF="24vcg07.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/24vcg07.gif">Figure 24.7. An AutoPlay-enabled CD-ROM in Explorer.</A></B>
<BR>
<P>The AutoRun facility added the AutoPlay selection to the list of actions in the pop-up menu. If you add the following lines to your AUTORUN.INF file, a new menu item will be added to the menu with the text Item For Menu. When this menu item is selected, the program specified in the command line will be executed.
<BR>
<PRE>
<FONT COLOR="#000080">shell\verb\command=filename.exe
shell\verb=Item For Menu</FONT></PRE>
<P>For example, to have the user check out a README file, you could add the following to the AUTORUN.INF file:
<BR>
<PRE>
<FONT COLOR="#000080">shell\readme\command=notepad readme.txt
shell\readme=Read &Me</FONT></PRE>
<P>In this example, the user's menu will include a Read Me selection. When selected, it will execute the Notepad program, loading and displaying the README.TXT file. Normally, the default menu selection for an AutoPlay-enabled CD is AutoPlay (as shown in Figure 24.7). You can change this default by adding
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">shell=<I>verb</I></FONT></PRE>
<P>The shell= line specifies the action that will take place when the user selects the AutoPlay menu option. For example, to activate the readme selection, you could include the following lines in your AUTORUN.INF file:
<BR>
<PRE>
<FONT COLOR="#000080">shell=readme
shell\readme\command=notepad readme.txt
shell\readme=Read &Me</FONT></PRE>
<P>In this example, if the user selects AutoPlay from the menu, the README.TXT file will be loaded in Notepad.
<BR>
<BR>
<A NAME="E69E294"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Suggestions for Creating AutoPlay CDs</B></FONT></CENTER></H4>
<BR>
<P>Microsoft has several suggestions for developers who are creating AutoPlay CDs. The most important is that the application that is launched automatically be small. For performance reasons, Microsoft recommends that you not try to load a large application whenever the CD is inserted. Instead, load the smaller teaser application, which will then let the user load the larger application.
<BR>
<P>For CD-ROMs that contain only data and no executable program, the teaser program could simply display a README file. This lets the user quickly determine the CD-ROM's contents. For data CD-ROMs, be sure to date the data using a date format that is easily understood. Don't use summer/winter/spring/fall designators: these seasons mean different things to people in different parts of the world. Also, don't use "1Q" designators, because these terms aren't always meaningful to all users. Instead, use months and years, such as January 1995, to date data. Your README file should also indicate how often the data on the CD-ROM is updated. For example, for a database of company information that is updated on a quarterly basis, you will want to inform the user when the data has become "stale" so that he or she can get an update to the CD-ROM. Here is the potential for marketing upgrades to products that are prone to become obsolete.
<BR>
<P>With applications in which the teaser or introduction program includes a button to let the user launch the full application, you can take advantage of Windows 95's multithreaded processes to begin the loading process. That way, if the user decides to start the application, you're one step ahead of the game and will be able to start the application (hopefully) without having to incur a long delay while the main program loads.
<BR>
<P>Try to create applications that run well from CD-ROMs when possible. This lets the user better manage his or her hard disk. If you must install programs or other files on the hard disk, use a recognized installation program (such as the InstallSHIELD SDK program, mentioned earlier) to let the user easily uninstall the program from his or her hard disk. There's nothing worse than having a CD-ROM-based application create a directory that contains virtually everything that is on the CD-ROM.
<BR>
<BR>
<A NAME="E68E129"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Demos and Shows</B></FONT></CENTER></H3>
<BR>
<P>It's always nice to be able to send a demo (either a working version or a canned demo, usually called a <I>show</I>) to a prospective purchaser. It's now possible to publish demos of your products using traditional techniques (such as either by itself or as part of a CD-ROM compilation) or using online publication techniques, including the Internet.
<BR>
<BR>
<A NAME="E69E295"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using DemoSHIELD</B></FONT></CENTER></H4>
<BR>
<P>There are a number of packages for creating demo programs. One such product is DemoSHIELD. It lets the developer create a professional demonstration of the product's capabilities without having to resort to low-level programming.
<BR>
<P>Using DemoSHIELD is easy. The WIN32SDK has a working demo model of DemoSHIELD that you can use. This version of the product is limited to three panels, but even with this limitation, you can still examine the product and see its capabilities.
<BR>
<BR>
<A NAME="E69E296"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Working Demos</B></FONT></CENTER></H4>
<BR>
<P>Many programmers distribute their applications using the "working demo" technique. This enables the potential user to use the application, get a feel for its weaknesses and strengths, and see how well the application fills his or her projected needs.
<BR>
<P>There is a difference between a working demo and using shareware to distribute your application. A working demo is almost always a copy of a product and has some limitation, such as a disabled save function. There is no way for most working demo programs to be upgraded without the user being sent a new copy of the program, whereas shareware programs typically either are fully functional or can be upgraded to full functionality by the user when the application is registered.
<BR>
<P>Distributing working demos and shareware applications is no different from distributing any other application. A smooth installation of the demo version goes a long way toward convincing a potential user to buy your product. A poor installation will convince users that your product is substandard, regardless of how well the application has been written.
<BR>
<BR>
<A NAME="E68E130"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>
<BR>
<P>Creating distribution disks is the final step in developing a Visual C++ database application, so it's fitting that this chapter closes this book. The objective of this book was to give DOS database developers and Visual C++ programmers who are new to database applications the background needed to create professional-grade database front ends with Visual C++. We hope this objective was accomplished.
<BR>
<P>Visual C++ is reportedly Microsoft's most successful and profitable language product. Therefore, you can expect Microsoft to release a continuing series of upgrades to Visual C++. Fortunately for Visual C++ developers, Microsoft has given its highest development priority to ensuring the compatibility of new versions of Visual C++ with code written for prior versions.
<BR>
<P>The remainder of this book consists of appendixes. Appendix A lists sources of add-on products and provides additional information for Visual C++ programmers. Appendix B lists the standard naming conventions for Visual C++ objects and variables. Appendix C gives you instructions for using the CD that comes with this book.
<BR>
<P ALIGN=CENTER>
<A HREF="vcg23.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcg23.htm" TARGET="_self"><IMG SRC="blanprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blanprev.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Previous Page"></A>
<A HREF="#I0" TARGET="_self"><IMG SRC="blantop.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantop.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Page Top"></A>
<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/index.htm" TARGET="_self"><IMG SRC="blantoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantoc.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="TOC"></A>
<A HREF="vcgp7.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcgp7.htm" TARGET="_self"><IMG SRC="blannext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blannext.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Next Page"></A>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -