/// <summary> /// Maps one of the COMMAND_* constants to the HTML 1.0 Help equivalent. /// </summary> private static int MapCommandToHTMLCommand(HelpNavigator command, string param, out object htmlParam) { htmlParam = param; if ((string.IsNullOrEmpty(param)) && (command == HelpNavigator.AssociateIndex || command == HelpNavigator.KeywordIndex)) { return(HH_DISPLAY_INDEX); } switch (command) { case HelpNavigator.Topic: return(HH_DISPLAY_TOPIC); case HelpNavigator.TableOfContents: return(HH_DISPLAY_TOC); case HelpNavigator.Index: return(HH_DISPLAY_INDEX); case HelpNavigator.Find: { NativeMethods.HH_FTS_QUERY ftsQuery = new NativeMethods.HH_FTS_QUERY { pszSearchQuery = param }; htmlParam = ftsQuery; return(HH_DISPLAY_SEARCH); } case HelpNavigator.TopicId: { try { htmlParam = int.Parse(param, CultureInfo.InvariantCulture); return(HH_HELP_CONTEXT); } catch { // default to just showing the index return(HH_DISPLAY_INDEX); } } case HelpNavigator.KeywordIndex: case HelpNavigator.AssociateIndex: { NativeMethods.HH_AKLINK alink = new NativeMethods.HH_AKLINK { pszKeywords = param, fIndexOnFail = true, fReserved = false }; htmlParam = alink; return((command == HelpNavigator.KeywordIndex) ? HH_KEYWORD_LOOKUP : HH_ALINK_LOOKUP); } default: return((int)command); } }
public static extern int HtmlHelp(HandleRef hwndCaller, [MarshalAs(UnmanagedType.LPTStr)] string pszFile, int uCommand, [MarshalAs(UnmanagedType.LPStruct)] NativeMethods.HH_AKLINK dwData);