application.Helpcommand中两个参数的含义(100分)

  • 主题发起人 主题发起人 CJ
  • 开始时间 开始时间
咦,
是一时没找到资料吗?
这是msdn中的说明:
CWinApp::WinHelp
virtual void WinHelp( DWORD dwData, UINT nCmd = HELP_CONTEXT );

Parameters

dwData

Specifies additional data. The value used depends on the value of the
nCmd parameter.

nCmd

Specifies the type of help requested. For a list of possible values
and how they affect the dwData parameter, see theWinHelp Windows
function.

Remarks

Call this member function to invoke the WinHelp application. The
framework also calls this function to invoke the WinHelp application.


The framework will automatically close the WinHelp application when
your application terminates.

Example

// 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);

CWinApp Overview | Class Members | Hierarchy Chart

See Also CWinApp::OnContextHelp, CWinApp::OnHelpUsing, CWinApp::OnHelp, CWinApp::OnHelpIndex,::WinHelp
 
查api:BOOL WinHelp(

HWND hWndMain, // handle of window requesting Help
LPCTSTR lpszHelp, // address of directory-path string
UINT uCommand, // type of Help
DWORD dwData // additional data
);
参数1 参数2
uCommand Action dwData
HELP_COMMAND Executes a Help macro or macro string. Address of a string that specifies the name of the Help macro(s) to execute. If the string specifies multiple macros names, the names must be separated by semicolons. You must use the short form of the macro name for some macros because Help does not support the long name.
HELP_CONTENTS Displays the topic specified by the Contents option in the [OPTIONS] section of the .HPJ file. This is for backward compatibility. New applications should provide a .CNT file and use the HELP_FINDER command. Ignored, set to 0.
HELP_CONTEXT Displays the topic identified by the specified context identifier defined in the [MAP] section of the .HPJ file. Unsigned long integer containing the context identifier for the topic.
HELP_CONTEXTPOPUP Displays, in a pop-up window, the topic identified by the specified context identifier defined in the [MAP] section of the .HPJ file. Unsigned long integer containing the context identifier for a topic.
HELP_FORCEFILE Ensures that WinHelp is displaying the correct help file. If the incorrect help file is being displayed, WinHelp opens the correct one; otherwise, there is no action. Ignored, set to 0.
HELP_HELPONHELP Displays help on how to use Windows Help, if the WINHELP.HLP file is available. Ignored, set to 0.
HELP_INDEX Displays the Index in the Help Topics dialog box. This command is for backward compatibility. New applications should use the HELP_FINDER command. Ignored, set to 0.
HELP_KEY Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one match, displays the Index with the topics listed in the Topics Found list box. Address of a keyword string.
HELP_MULTIKEY Displays the topic specified by a keyword in an alternative keyword table. Address of a MULTIKEYHELP structure that specifies a table footnote character and a keyword.
HELP_PARTIALKEY Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one match, displays the Index tab. To display the Index without passing a keyword (the third result), you should use a pointer to an empty string. Address of a keyword string.
HELP_QUIT Informs the Help application that it is no longer needed. If no other applications have asked for Help, Windows closes the Help application. Ignored, set to 0.
HELP_SETCONTENTS Specifies the Contents topic. The Help application displays this topic when the user clicks the Contents button. Unsigned long integer containing the context identifier for the Contents topic.
HELP_SETINDEX Specifies a keyword table to be displayed in the Index of the Help Topics dialog box. Unsigned long integer containing the context identifier for the Index topic.
HELP_SETWINPOS Displays the Help window, if it is minimized or in memory, and sets its size and position as specified. Address of a HELPWININFO structure that specifies the size and position of either a primary or secondary Help window.
 
补充一下:
Before closing the window that requested Help, the application must
call WinHelp with the uCommand parameter set to HELP_QUIT. Until all
applications have done this, Windows Help will not terminate. Note
that calling Windows Help with the HELP_QUIT command is not necessary
if you used the HELP_CONTEXTPOPUP command to start Windows Help.

The following table shows the possible values for the uCommand
parameter and the corresponding formats of the dwData parameter.

nCommand ActiondwData
HELP_COMMAND
Executes a Help macro or macro string. Address of a string that
specifies the name of the Help macro(s) to run. If the string
specifies multiple macro names, the names must be separated by
semicolons. You must use the short form of the macro name for some
macros because Windows Help does not support the long name.

HELP_CONTENTS
Displays the topic specified by the Contents option in the
[OPTIONS] section of the .hpj file. This command is for backward
compatibility. New applications should provide a .cnt file and use
the HELP_FINDER command. Ignored, set to 0.

HELP_CONTEXT
Displays the topic identified by the specified context identifier
defined in the [MAP] section of the .hpj file. Unsigned long integer
containing the context identifier for the topic.

HELP_CONTEXTMENU
Displays the Help menu for the selected window, then displays the
topic for the selected control in a pop-up window. Address of an
array of double word pairs. The first double word in each pair is a
control identifier, and the second is a context number for a topic.

HELP_CONTEXTPOPUP
Displays the topic identified by the specified context identifier
defined in the [MAP] section of the .hpj file in a pop-up window.
Unsigned long integer containing the context identifier for a topic.

HELP_FINDER
Displays the Help Topics dialog box. Ignored; set to 0.

HELP_FORCEFILE
Ensures that Windows Help is displaying the correct Help file. If
the incorrect Help file is being displayed, Windows Help opens the
correct one; otherwise, there is no action. Ignored, set to 0.

HELP_HELPONHELP
Displays Help on how to use Windows Help, if the WINHLP32.HLP
file is available. Ignored, set to 0.

HELP_INDEX
Displays the topic specified by the Contents option in the
[OPTIONS] section of the .hpj file. This command is for backward
compatibility. New applications should use the HELP_FINDER command.
Ignored, set to 0.

HELP_KEY
Displays the topic in the keyword table that matches the specified
keyword, if there is an exact match. If there is more than one match,
displays the Index with the topics listed in the Topics Found list
box. Address of a keyword string. Multiple keywords must be separated
by semicolons.

HELP_MULTIKEY
Displays the topic specified by a keyword in an alternative
keyword table. Address of a MULTIKEYHELP structure that specifies a
table footnote character and a keyword.

HELP_PARTIALKEY
Displays the topic in the keyword table that matches the
specified keyword, if there is an exact match. If there is more than
one match, displays the Topics Found dialog box. To display the Index
without passing a keyword, you should use a pointer to an empty
string. Address of a keyword string. Multiple keywords must be
separated by semicolons.

HELP_QUIT
Informs Windows Help that it is no longer needed. If no other
applications have asked for Help, Windows closes Windows Help.
Ignored, set to 0.

HELP_SETCONTENTS
Specifies the Contents topic. Windows Help displays this topic
when the user clicks the Contents button if the Help file does not
have an associated .cnt file. Unsigned long integer containing the
context identifier for the Contents topic.

HELP_SETPOPUP_POS
Sets the position of the subsequent pop-up window. Address of
aPOINTS structure. The pop-up window is positioned as if the mouse
cursor were at the specified point when the pop-up window is
invoked.

HELP_SETWINPOS
Displays the Help window, if it is minimized or in memory, and
sets its size and position as specified. Address of a HELPWININFO
structure that specifies the size and position of either a primary or
secondary Help window.

HELP_TCARD
Indicates that a command is for a training card instance of
Windows Help. Combine this command with other commands using the
bitwise OR operator. Depends on the command with which this command
is combined.

HELP_WM_HELP
Displays the topic for the control identified by the hWndMain
parameter in a pop-up window. Address of an array of double word
pairs. The first double word in each pair is a control identifier,
and the second is a context identifier for a topic.

活干完了:)
 
后退
顶部