Help RTF files from Resource RC Files

Environment: VC6

I had just about completed a medium-sized project with quite a few dialogs and menus in it, and it was time to start writing help files. Yuk! I still use WinHelp-based help, partly because I like it, and partly because MFC supplies transparent F1 help, but being an impoverished cheapskate academic I haven't got a commercial help generator. This meant facing several days of wrestling with WinWord in RTF format, and I knew from experience that I was going to be bored stiff and make lots of typing errors in creating the links.

Being infinitely distractable, I decided that it would be be worth spending some time writing a topic generator that could read my RC file and create skeleton RTF files for the menus and dialogs. The program "Help RC" is the result.

The program parses the selected RC file looking for dialogs, menu items and string resources associated with menu IDs (the menu prompts). It takes rather a brute-force approach to the parsing, just looking for the appropriate keyword headers in the RC file (it skips the DESIGNINFO section). It stores dialog and menu captions, and the menu prompts in Maps, with the ID as the key. I used maps because I wanted to eliminate duplicate menu items with the same ID occurring on different menus. It then iterates through the dialog and menu maps, passing the dialogs and menu items to list boxes for sorting and display.

The program can write 3 types of RTF help file. The "Dlg RTF" button writes out a file where each dialog has a separate page, with the dialog caption as a title line, and the ID (with 'H' prepended) as the #-footnote. Keyword and title footnotes are also written, with the caption as the text. The "Menu RTF" button does a similar job, but each page represents a particular menu item (duplicates are eliminated).

The "Menu Tab" button is a bit different. It writes out a separate page for each top-level popup menu in each menu resource. The page shows a table with each menu item on a different row. The first column shows the menu title (sub-menu items are prepended by the sub-menu popup caption), while the second column shows the prompt extracted from the string table with the same ID as the menu item. The overall result is like the various menu pages of the default file "Afxcore.rtf" generated by the framework. The only tricky bit of the "Menu Tab" option is dealing with sub-menus. To do this the program parses the RC file again, and has a simple stack-like response to sub-menus (popups within popups). It stores the caption of the sub-menu, and prepends it to the caption of the actual menu item.

I don't claim to be any expert in RTF format - I 'stole' code from Word-generated files, and whittled it down by experiment to what appears to be the essentials to get the display I wanted. Neither do I claim that the RC parsing-bit is bullet-proof. However, it's worked OK so far on my files, and saved me quite a bit of time, so I offer the program in the hope that it may also be useful to other people.

Downloads

Download demo project - 21 Kb


Comments

  • As the author says, a very handy little tool.

    Posted by TroubleShooter on 03/12/2004 12:57pm

    Thanks.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

Most Popular Programming Stories

More for Developers

RSS Feeds