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

📄 ch11.htm

📁 VC使用大全。里面集合了VC使用的各种使用技巧。非常有用。
💻 HTM
📖 第 1 页 / 共 5 页
字号:

<pre><font color="#008000">}</font></pre>

<P>This function doesn't need to check that the right-click is on a control as <font color="#008000">OnHelpInfo()</font> did, so it just calls the SDK WinHelp. <font color="#008000">WinHelp()</font> takes care of displaying the shortcut menu with only a 
What's This item and then displays Help when that item is chosen.</P>

<P>To check your typing, build the project by choosing <U>B</U>uild, <U>B</U>uild, and then compile the Help file by giving focus to <font color="#008000">ShowString.hpj</font> and choosing <U>B</U>uild, <U>C</U>ompile. (You also can right-click <font 
color="#008000">ShowString.hpj</font> in the File View of the Project Workspace Window and choose <U>C</U>ompile from the shortcut menu.) There's not much point in testing it, though; the AppWizard stuff is sure to work, and without Help content connected 
to those topics, none of the code you just added can succeed in displaying content.</P>

<H3><B>Writing Help Text</B></H3>

<P>You write Help text in an RTF file, using special formatting codes, which mean something rather different than they usually do. The traditional way to do this was in Word, but a large crop of Help authoring tools have sprung up that are far easier to 
use than Word. Rather than teach you yet another tool, this section presents instructions for writing Help text in Word. However, do keep in mind that there are easier ways, and on a project of a decent size you easily save the time and money you invest in 
a Help authoring tool. There is an entire chapter in <I>Designing Windows 95 Help</I> on choosing an authoring tool.</P>

<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">

<P>You can open Word documents from within Developer Studio. Choose File, Open, and select the file. The Word menus and toolbars will appear. This works because Word documents are ActiveX Document Objects, discussed in <A HREF="index15.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index15.htm" 
target="text">Chapter 15</A>, &quot;Building an ActiveX Server Application.&quot; Most developers prefer to switch from Word to Developer Studio with the taskbar than to have a number of files open in Developer Studio and to switch among them with the 
Window menu, so the explanations in this section assume you are running Word separately. If you would rather work entirely within Developer Studio, feel free to so do.</P>

<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>

<P>Figure 11.6 shows <font color="#008000">afxcore.rtf</font> open in Word. Choose <U>V</U>iew, <U>F</U>ootnotes to display the footnotes across the bottom of the screen&#151;they are vital. This is how the text connects to the Help topic IDs. Choose 
<U>T</U>ools, <U>O</U>ptions, select the View tab, and make sure the hidden text check box is selected. This is how links between topics are entered. The topics are separated by page breaks.</P>

<A HREF="Mfigs06.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs06.gif"><b>Fig. 11.6</b></A>

<P><I>Help text, like this boilerplate provided by AppWizard, can be edited in Word for Windows.</I></P>

<P>There are eight kinds of footnotes and each has a different meaning. Only the first three footnote types in the following list are in general use:</P>

<ul>

<li> <B>#, the Help topic ID.</B> The SDK WinHelp function looks for this topic ID when displaying Help.</P>

<li> <B>$, the topic title.</B> This title displays in search results.</P>

<li> <B>K, keywords.</B> These appear in the Index tab of the Help Topics dialog box.</P>

<li> <B>A, A-keyword.</B> These keywords can be jumped to but do not appear in the Index tab of the Help Topics dialog box.</P>

<li> <B>+, browse code.</B> This marks the topic's place in a sequence of topics.</P>

<li> <B>!, macro entry.</B> This<B> </B>makes the topic a macro to be run when the user requests the topic.</P>

<li> <B>*, build tag.</B> You use this to include certain tags only in certain builds of the Help file.</P>

<li> <B>&gt;, window type.</B> This overrides the type of window for this topic.</P>

</ul>

<P>The double-underlined text, followed by hidden text, identifies a jump to another Help topic. If a user clicks to follow the link, this Help topic leaves the screen. If the text before the hidden text was single-underlined, following the link opens a 
pop-up over this Help topic, perfect for definitions and notes. (You also may see Help text files in which strikethrough text is used; this is exactly the same as double-underlined&#151;a jump to another topic.) In all three cases, the hidden text is the 
topic ID of the material to be jumped to or popped up.</P>

<P>Figure 11.7 shows how the <U>F</U>ile, <U>N</U>ew Help material appears from within ShowString. To display it yourself, run ShowString by choosing <U>B</U>uild, <U>E</U>xecute from within Developer Studio, and then choose <U>H</U>elp, <U>H</U>elp 
topics in ShowString. Open the menus book, double-click the File menu topic, and click New.</P>

<A HREF="Mfigs07.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs07.gif"><b>Fig. 11.7</b></A>

<P><I>ShowString displays the boilerplate Help generated by AppWizard.</I></P>

<P>With the programming out of the way, it's time to tackle the list of Help tasks for ShowString from the &quot;Planning Your Help Approach&quot; section earlier in this chapter. These instructions assume you are using Word.</P>

<P><B> Changing Placeholder Strings</B></P>

<P>To change the placeholder strings left behind by AppWizard in the boilerplate Help files, open <font color="#008000">afxcore.rtf</font> in Word. (It's in the hlp folder of the ShowString project folder.) Then follow these steps:</P>

<ol>

<li><P> Position the cursor at the very beginning of the document and choose <U>E</U>dit, <U>R</U>eplace.</P>

<li><P> Enter <B>&lt;&lt;YourApp&gt;&gt;</B> in the Fi<U>n</U>d What box and <B>ShowString</B> in the Re<U>p</U>lace With box</P>

<li><P> Click Replace All.</P>

</ol><P>Open <font color="#008000">afxprint.rtf</font> and repeat these steps.</P>

<P>Switch back to <font color="#008000">afxcore.rtf</font>, and look through the text for <font color="#008000">&lt;&lt;</font> characters (use <U>E</U>dit, <U>F</U>ind, and remember that Shift+F4 is the shortcut to repeat your previous Find). These 
identify places where you must make a change or a decision. For ShowString, the changes in <font color="#008000">afxcore.rtf</font> are these:</P>

<ol> 

<li><P> The first section in the file is the ShowString Help Index. Remove the How To section and the reminder to add some How To topics. In a real application, you add topics here.</P>

<li><P> The next section, after the page break, is a table describing the items on the <U>F</U>ile menu. Since there is no Send item on ShowString's <U>F</U>ile menu, remove the Send row of the File menu table.</P>

<li><P> The third section is a table listing the items on the <U>E</U>dit menu. Remove the Paste Link, Insert New Object, and Links rows.</P>

<li><P> The fourth section is for the <U>V</U>iew menu and does not need any changes.</P>

<li><P> The fifth section is for the <U>W</U>indow menu. Remove the Split row from the Window menu table.</P>

<li><P> The sixth section is for the <U>H</U>elp menu and does not need any changes.</P>

<li><P> The seventh section is for the New command (<U>F</U>ile menu). Remove the sentence about choosing a file type and the reminder to remove it.</P>

<li><P> Delete the eighth section, the File New dialog box topic, entirely, including the page break before or after it, but not both. Whenever you remove a section, remove on of the breaks so that the file does not contain two consecutive page 
breaks.</P>

<li><P> The next topic is for the File Open command and does not need any changes.</P>

<li><P> Moving on to the File Open dialog box topic, edit the text to mention that the List Files of Type list box contains only <font color="#008000">All Files</font>.</P>

<li><P> Continue down the file until you find the File Send topic and remove it entirely, including the page break before or after it.</P>

<li><P> In the File Save As topic, remove the suggestion to describe other options since there are none.</P>

<li><P> When you reach the Edit Undo topic, you start to see why programs written after their manuals are better programs. The way ShowString was written in <A HREF="index09.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index09.htm" target="text">Chapter 9</A>, &quot;Building a Complete Application: 
ShowString,&quot; the Undo item will never be enabled, nor will Cut, Copy, or Paste. You could remove the Help topics about these unsupported menu items, but it's probably better to plan to add support for the menu items to a later version of ShowString. 
Add some text to all these topics explaining that they are not implemented in this version of the product. Leave the shortcuts sections there so that users can find out why Ctrl+Z does nothing.</P>

<li><P> Continue down through the file to the Toolbar topic, where you find this reminder: <font color="#008000">&lt;&lt; Add or </font><font color="#008000">remove toolbar buttons from the list below according to which ones your application offers. 
&gt;&gt;</font> Remove the reminder and delete the references to the Undo, First Record, Previous Record, Next Record, and Last Record buttons.</P>

<li><P> About halfway down the file is a topic for <font color="#008000">#Split</font> Command (Window menu). Remove the entire topic.</P>

<li><P> Move down to the <font color="#008000">#Index</font> command (Help menu) topic and remove it. Also remove the Using Help command (Help menu) and <font color="#008000">#About</font> command (Help menu) topics.</P>

<li><P> In the Title Bar topic, remove the directive to insert a graphic. If you would rather follow the directive, create a bitmap in a .bmp file of the title bar with screen shot software, cropping the shot down to just the title bar, and insert the 
graphic with the <font color="#008000">bmc</font> directive, just as the <font color="#008000">bullet.bmp</font> graphic is inserted a few lines lower in the file.</P>

<li><P> Because the ShowString view does not inherit from <font color="#008000">CScrollView</font>, it doesn't scroll. Remove the Scrollbars Help topic and its page break.</P>

<li><P> In the Close command topic (not the File Close topic, which was much earlier in the file,) the shortcut for Alt+F4 should be described like this: <font color="#008000">closes ShowString</font>.</P>

<li><P> Remove the Ruler, Choose Font, Choose Color, Edit Find, Find Dialog, Edit Replace, Replace dialog box, Edit Repeat, Edit Clear, Edit Clear All, Next Pane, and Previous Pane topics.</P>

<li><P> Skip the How To Modify Text topic for now and leave it unchanged.</P>

<li><P> Remove the final directive about tailoring the No Help Available messages to each message box.</P>

</ol>

<P>That completes the extensive changes required to the boilerplate <font color="#008000">afxcore.rtf</font> file generated by AppWizard. In the other boilerplate file, <font color="#008000">afxprint.rtf</font>, simply scroll to the bottom and remove the 
Page Setup topic.</P>

<P>Would you like to test all this work? Save <font color="#008000">afxcore.rtf</font> and <font color="#008000">afxprint.rtf</font> within Word. Switch to Developer Studio and choose <U>B</U>uild, <U>B</U>uild to bring the project up to date. Then open 
<font color="#008000">ShowString.hpj</font> and choose <U>B</U>uild, <U>C</U>ompile. This pulls all the .rtf files together into <font color="#008000">ShowString.hlp</font>. Choose <U>B</U>uild, <U>E</U>xecute to run ShowString, and choose <U>H</U>elp, 
<U>H</U>elp Topics from the ShowString menus. As you can see in Figure 11.8, the Window menu topic is now substantially shorter. You can check that your other changes have been made, as well.</P>

<A HREF="Mfigs08.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs08.gif"><b>Fig. 11.8</b></A>

<P><I>After saving the rtf files and compiling the Help project, you can test to see that your changes have been </I><I>made successfully.</I></P>

<P><B>Adding Topics</B></P>

<P>When you are adding new topics, you don't add new topics to the boilerplate files that were provided. Those files should stay untouched unless you want to change the description of File Open or other boilerplate topics. Instead, create a new file by 
choosing <U>F</U>ile, <U>N</U>ew in Word and saving it in the hlp folder of the ShowString project folder as <font color="#008000">ShowString.rtf</font>. (Make sure to change the Save File As Type list box selection to Rich Text Format.) If this was a 
large project, you could divide it up into several .rtf files, but one will suffice for ShowString. In Developer Studio, open <font color="#008000">ShowString.hpj</font> by double-clicking it in the FileView tab, and find the section headed <font 
color="#008000">[FILES]</font>. Add this line at the end of that section:</P>

<pre><font color="#008000">showstring.rtf</font></pre>

<P><B>The Tools Menu</B></P>

<P>Back in Word, switch to <font color="#008000">afxcore.rtf</font> and copy the topic for the <U>F</U>ile menu into the Clipboard; then switch back to <font color="#008000">ShowString.rtf</font> and paste it in. (Don't forget to include the page break 
after the topic in the selection when you copy.) Choose <U>V</U>iew, <U>F</U>ootnotes to display the footnotes, and <U>T</U>ools, <U>O</U>ptions, View tab, H<U>i</U>dden Text to display the hidden text. Now you are going to edit the copied File topic to 
make it the Tools topic. Change the footnotes first. They are as follows:</P>

<ul>

<li> The # footnote is the topic ID. The Help system uses this to find this topic from the Contents page. Change it to <B><font color="#008000">menu_tools</font></B>.</P>

<li> The K footnote is the keyword entry. Although the Options dialog box probably deserves several keywords, this menu doesn't, so remove that footnote by selecting the letter K in the Help topic and pressing Delete. You must select the letter; it is not 
enough to click just before it. The footnote is deleted at the same time.</P>

<li> The $ footnote is the topic title. Change it to <B><font color="#008000">Tools menu commands</font>U></B>.</P>

</ul>

<P>In the topic, change <font color="#008000">File</font> to <B><font color="#008000">Tools</font></B> on the first two lines, and delete all the rows of the table but one. Change the underlined text of that row to Options, the hidden text immediately 
following to <font color="#008000">HID_TOOLS_OPTIONS</font>, and the right column of that row to <font color="#008000">Changes string, </font><font color="#008000">color, and centering</font>. Figure 11.9 shows the way <font 
color="#008000">ShowString.rtf</font> looks in Word after these changes.</P>

<A HREF="Mfigs09.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs09.gif"><b>Fig. 11.9</b></A>

<P><I>Change the </I><I>ShowString.rtf</I><I> file to explain the new menu item.</I></P>

<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">

<P>If you can't remember the Help topic IDs your project is using, check your .hm files. The ones added by Developer Studio, such as <font color="#008000">HID_TOOLS_OPTIONS</font> for the menu item with resource <font color="#008000">ID 
ID_TOOLS_OPTIONS</font>, are in <font color="#008000">ShowString.hm</font>, whereas <font color="#008000">ShowStringx.hm</font> contains the Help topic IDs added by hand for context Help.</P>

<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>

<P><B>The </B><B><U>T</U></B><B>ools, </B><B><U>O</U></B><B>ptions menu item</B></P>

<P>Switch back to <font color="#008000">afxcore</font>, copy the File New topic, and paste it into <font color="#008000">ShowString.rtf</font> as before. The topic and its footnotes are copied together. Watch carefully to be sure you are working with the 
footnotes for the Tools Options topic and not the ones for the <U>T</U>ools menu. Follow these steps:</P>

⌨️ 快捷键说明

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