16. Managing and Deploying Applications : How You Can Create and Distribute Help Files : Create Help Files : Call Help Topics
 
Share this page                  
Call Help Topics
There are various ways to manipulate the help system from your application.
To call the table of contents for the online help system
on Click =
{
          CurSession.WinHelp
          (command=HV_CONTENTS,helpfile='myapp.hlp');
};
To call help for fields
Context-sensitive help for fields requires that each field have a help topic associated with it. One way to do that is to embed the field help topic in the field's ClientText attribute. For example, the client text for a field could contain the string “helptopic=Employee Name;”.
You can use the following code to check for the keyword “helptopic” in the field's client text at runtime. If the keyword is found, the code calls Help and specifies the value for that keyword as the topic:
on Click =
declare
          topic = varchar(32) not null;
enddeclare
{
          if CurFrame.InputFocusField is not null then
                    topic = _StringParseKeyword(keyword = 'helptopic', string=
                              CurFrame.InputFocusField.ClientText);
                    if topic != '' then
                              CurSession.WinHelp(command = HV_KEY,
                              topic = topic, helpfile = 'myapp.hlp');
                    else
                              message 'No help for this field.';
                    endif;
          else
                    message 'Select a field before choosing Field
                             Help.';
          endif;
}
Note:  _StringParseKeyword() is a general-purpose procedure, documented in online help and the Programming Guide.
To display online help for a frame
on Click =
{
          CurSession.WinHelp(command = HV_KEY, topic = 'Add
                    Employees', helpfile = 'myapp.hlp');
}
To call information about the help system itself (that is, to include the How To Use Help menu command)
on Click =
{
          CurSession.WinHelp(command = HV_HELPONHELP,
                    helpfile = 'myapp.hlp')
}
For more information about creating help files, see the Microsoft Visual C++ Help documentation.