Solved

Can't get WinHelp to find my context identifier

Posted on 2001-06-20
2
330 Views
Last Modified: 2013-11-20
I want to call my help file from a page in my property sheet, bringing up the correct help topic.

My call looks like this:

   ::WinHelp (((NMHDR*) lParam)->hwndFrom, "WinTAP.HLP", HELP_CONTEXT, 0x20096);

My .hpj file looks like:

[MAP]
   #include ..\..\..\MFC\include\afxhelp.hm
   #include <WinTAP.hm>
   phase_title=0x20096

"phase_title" is the name of one of the topics in my help file.  The links to "phase_title" work from within the help file, but not from my app:  I get a "Topic does not exist error" when WinHelp is called.

What am I doing wrong?

Thanks.
0
Comment
Question by:SixString
2 Comments
 
LVL 2

Accepted Solution

by:
GloriousRain earned 100 total points
ID: 6212746
You shouldn't call WinHelp with directly dwData value as in help project. Just define help id in resource.h, build hm file then call that id in WinHelp.

see below article for more info

// Header File: HELPIDS.H
//
// This example header file is #include'd twice:
// (1) It is #include'd by the .CPP file that passes the DWORD
//     context i.d. to CWinApp::WinHelp.
// (2) It is #include'd in the [MAP] section of the .HPJ file,
//     to associate the help context string "HID_MYTOPIC" with
//     the help context numeric i.d., 101.
// The help context string "HID_MYTOPIC" is what identifies the
// help topic in the help .RTF source file, in the "#" footnote:
//     # HID_MYTOPIC
//
// Note, it is not necessary to manage help context id's this way
// for help topics associated with command id's and user interface
// id's defined in your RESOURCE.H file; you should use the MAKEHM
// tool via the custom build rule on your resource.h file to produce
// a help map (.HM) file for these id's.  It is necessary to manage
// help context id's as illustrated here only for help topics not
// associated with command id's or user interface id's.

#define HID_MYTOPIC 101
 

   // Show the custom help topic that has the context string
   // "HID_MYTOPIC" in the help .RTF file, and which is mapped
   // to the DWORD i.d. HID_MYTOPIC in the above HELPIDS.H file.
   AfxGetApp()->WinHelp(HID_MYTOPIC);
 

// The following is one line of code in the help map (.HM)
// file produced by the MAKEHM tool, which is called by the custom
// build rule on the resource.h file.  The MAKEHM tool reads the
// following #define in the application's RESOURCE.H file:
//    #define ID_MYCOMMAND 0x08004
// and adds a help id offset value of 0x10000 to create the
// help context DWORD value 0x18004.  See MFC Tech Note 28
// for more information on help id offset values.
 
HID_MYCOMMAND                           0x18004
 

   // Rarely will you need to directly call WinHelp yourself
   // with the help context i.d. for a command or user interface
   // object. The framework will call WinHelp automatically when
   // the user, for example, hits F1 when the focus is on a
   // My Command menu item. However, if you do want to directly
   // call WinHelp for the help topic associated with the command,
   // here is how you would do it:

   AfxGetApp()->WinHelp(0x10000 + ID_MYCOMMAND);

0
 

Author Comment

by:SixString
ID: 6219517
Actually, all I needed to do was change my Topic IDs to match those in the .hm file.

Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
if loop error 4 77
cat dog challenge 18 122
has77  challenge 9 67
Unix Command -- Challenging  question 7 79
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now