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

📄 ch25.htm

📁 VC使用大全。里面集合了VC使用的各种使用技巧。非常有用。
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<P>You can use Component Gallery to manage many other types of components, including those that you might get from a friend or buy from a third-party supplier. Component Gallery can add, delete, import, 
and edit components in a variety of ways, depending upon the type of component with which you're working. Take some time to experiment with Component Gallery, and you'll quickly see how easy it is to use.</P>
<P>Figure 25.5 shows the contents of the 
Registered ActiveX Controls folder. Both the ATL and MFC versions of the Dieroll control are here: DieRoll Class was built in <A HREF="index21.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index21.htm" target="text">Chapter 21</A>, &quot;The Active Template Library,&quot; and Dieroll Control was built in <A 
HREF="index17.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index17.htm" target="text">Chapter 17</A>, &quot;Building an ActiveX Control.&quot; Before this shot was taken, Grid Control was highlighted and the More Info button was clicked. Components can be bundled with a help file that is reached from the 
More Info button.</P>
<A HREF="Zfigs05.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs05.gif"><b>Fig. 25.5</b></A>
<P><I>All ActiveX controls are available through the Gallery.</I></P>
<H3><B>Introducing Custom AppWizards</B></H3>
<P>AppWizard is a sensational tool for getting projects started 
quickly and easily. However, because of its general nature, AppWizard makes many assumptions about the way you want a new project created. Sometimes, you may need a special type of AppWizard project that isn't supported by the default AppWizard. If this 
special project is a one-time deal, you'd probably just go ahead and create the project by hand. However, if you need to use this custom project type again and again, you might want to consider creating a custom AppWizard.</P>
<P>You can create a custom 
AppWizard in three ways: using the existing AppWizard steps as a starting point, using an existing project as a starting point, or starting completely from scratch. However, no matter what method you choose, creating a custom AppWizard can be a complicated 
task, requiring that you understand and be able to write script files by using the macros and commands provided by Visual C++ for this purpose.</P>
<P>The followingtackles the very simplest case first, creating an AppWizard that can reproduce an existing 
project with a different name. Follow these steps:</P>
<ol> 
<li><P> Create a project in the usual way. Call it Original and click Finish on Step 1 to accept all the AppWizard defaults.</P>
<li><P> Edit the About box to resemble Figure 25.6</P>
</ol>
<A 
HREF="Zfigs06.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs06.gif"><b>Fig. 25.6</b></A>
<P><I>Customize your About box.</I></P>
<ol start=3>
<li><P> Choose File, New, and click the Projects tab. Select Custom AppWizard and enter OrigWiz, as shown in Figure 25.7. Click OK.</P>
</ol>
<A 
HREF="Zfigs07.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs07.gif"><b>Fig. 25.7</b></A>
<P><I>Create a Custom AppWizard</I></P>
<ol start=4>
<li><P> The first of two custom AppWizard dialogs appears, as shown in Figure 25.8. Select An Existing Project to base your wizard on the project you 
created in steps 1 and 2. Do not edit the name of the wizard. Click Next.</P>
</ol>
<A HREF="Zfigs08.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs08.gif"><b>Fig. 25.8</b></A>
<P><I>Base your wizard on an existing project.</I></P>
<ol start=5>
<li><P> The second custom AppWizard dialog box 
appears, shown in Figure 25.9. Browse to the project file for the Original project. Click Finish.</P>
<li><P> The New Project Information dialog, shown in Figure 25.10, confirms your choices. Click OK.</P>
</ol>
<A HREF="Zfigs10.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs10.gif"><b>Fig. 
25.9</b></A>
<P><I>Your Custom AppWizard will create copies of the Original project with </I><I>different names.</I></P>
<P>You are now working on the OrigWiz project, and in many cases you would add code at this point. Since this is a sample, just build 
the project immediately.</P>
<P>To use your custom AppWizard, choose File, New again and click the Projects tab. As shown in Figure 25.11, OrigWizard has been added to the list of choices on the left. Select it and enter App3 for the name of the project. 
Click OK.</P>
<A HREF="Zfigs11.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs11.gif"><b>Fig. 25.10</b></A>
<P><I>Your Custom AppWizard has been added to the list of AppWizards.</I></P>
<blockquote><p><img src="note.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/note.gif">
<P>When you compile the custom AppWizard, Developer Studio creates the 
final files and stores them in your C:\Program Files\DevStudio\SharedIDE\Template directory. The next time you choose to start a new project workspace, your custom AppWizard will be listed in the project types. To remove the custom AppWizard, delete the 
wizard's .awx and .pdb files from your C:\Program Files\DevStudio\SharedIDE\Template directory.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<P>Figure 25.12 shows one of the tasks that you normally complete before you build the AppWizard: generating the text 
for the New Project Information dialog box. Click OK.</P>
<A HREF="Zfigs12.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs12.gif"><b>Fig. 25.11</b></A>
<P><I>You have to write the text for the New Project Information dialog.</I></P>
<P>Look at the class names and the code&#151;App3 looks like 
any of the projects created in this chapter that accept all the AppWizard defaults, but you didn't have to go through any dialog steps. Switch to ResourceView and edit IDD_ABOUTBOX. As Figure 25.13 shows, it contains the extra text (Based on Original 1.0) 
you added, but the application name on the top line of the box has been correctly changed to App3. This is one smart wizard.</P>
<A HREF="Zfigs13.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch25/Zfigs13.gif"><b>Fig. 25.12</b></A>
<P><I>Your custom About box was copied to the new project by your 
AppWizard.</I></P>
<P>When you build a wizard from an existing project, all the classes, resources, and code that you added will be incorporated in the new projects you generate with the wizard. It's a great timesaver.</P>
<P>You can also build custom 
AppWizards that present dialogs for you to fill out. Before you do that, you should be comfortable writing wizards that are not AppWizards, like the ones discussed in <A HREF="index12.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index12.htm" target="text">Chapter 12</A>, &quot;Property Pages and Sheets and 
Wizards.&quot; You should also have generated lots of different types of applications so that you have a feel for the sort of work AppWizard does. When you're ready, check the section in the online help entitled &quot;Creating Custom AppWizards.&quot;</P>

<H3><B>From Here...</B></H3>
<P>This whole book has shown you the value of using other people's designs, classes, code, controls, dialog boxes, and other project parts. This chapter has shown two simple ways that you can arrange for other people (or your 
future self) to reuse your code. This can bring real benefits to your customers or employer by saving significant development time. And it can make your job more fun, by taking care of the repetitive tasks like building a dialog and associating it with a 
class, freeing you to do the fun stuff.</P>
<P>For more information on related topics, please refer to the following chapters:</P>
<ul>
<li> <A HREF="index01.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index01.htm" target="text">Chapter 1</A>, &quot;Your First Application&quot; introduces AppWizard.</P>

<li> <A HREF="index12.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index12.htm" target="text">Chapter 12</A>, &quot;Property Pages and Sheets and Wizards,&quot; teaches you how to build wizard dialog boxes with Next and Back buttons.</P>
<li> <A HREF="index17.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index17.htm" target="text">Chapter 17</A>, &quot;Building 
an ActiveX Control,&quot; describes one type of component you can add to Component Gallery.</P>
</ul>
<p><hr></p>
<center>
<p><font size=-2>
&copy; 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a
Simon and Schuster Company.</font></p>

</center>
</BODY></HTML>

⌨️ 快捷键说明

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