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.


Download demo project - 21 Kb


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

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


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

Top White Papers and Webcasts

  • Lenovo recommends Windows 8 Pro. "I dropped my laptop getting out of the taxi." This probably sounds familiar to most IT professionals. If your employees are traveling, you know their devices are in for a rough go. Whether it's a trip to the conference room or a convention out of town, any time equipment leaves a user's desk it is at risk of being put into harm's way. Stay connected at all times, whether at the office or on the go, with agile, durable, and flexible devices like the Lenovo® …

  • On-demand Event Event Date: September 23, 2015 The cloud is not just about a runtime platform for your projects – now, you can do your development in the cloud, too. Check out this webcast to learn how the cloud improves your development experience and team collaboration. Join Dana Singleterry, Principal Product Manager for Oracle Dev Tools, as he discusses how to simplify every aspect of the development lifecycle, including requirements gathering, version management, code reviews, build automation, and …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date