/// <include file='doc\Help.uex' path='docs/doc[@for="Help.ShowHTML10Help"]/*' /> /// <devdoc> /// Displays HTML 1.0 Help with the specified parameters /// </devdoc> /// <internalonly/> private static void ShowHTML10Help(Control parent, string url, HelpNavigator command, object param) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "Help:: ShowHTML10Help:: " + url + ", " + command.ToString("G") + ", " + param); // See if we can get a full path and file name and if that will // resolve the out of memory condition with file names that include spaces. // If we can't, though, we can't assume that the path's no good: it might be in // the Windows help directory. Uri file = null; string pathAndFileName = url; //This is our best guess at the path yet. file = Resolve(url); if (file != null) // Can't assume we have a good url { pathAndFileName = file.AbsoluteUri; } if (file == null || file.IsFile) { StringBuilder newPath = new StringBuilder(); string localPath = (file != null && file.IsFile) ? file.LocalPath : url; // If this is a local path, convert it to a short path name. Pass 0 as the length the first time uint requiredStringSize = UnsafeNativeMethods.GetShortPathName(localPath, newPath, 0); if (requiredStringSize > 0) { //It's able to make it a short path. Happy day. newPath.Capacity = (int)requiredStringSize; requiredStringSize = UnsafeNativeMethods.GetShortPathName(localPath, newPath, requiredStringSize); //If it can't make it a short path, just leave the path we had. pathAndFileName = newPath.ToString(); } } HandleRef handle; if (parent != null) { handle = new HandleRef(parent, parent.Handle); } else { handle = new HandleRef(null, UnsafeNativeMethods.GetActiveWindow()); } object htmlParam; string stringParam = param as string; if (stringParam != null) { int htmlCommand = MapCommandToHTMLCommand(command, stringParam, out htmlParam); string stringHtmlParam = htmlParam as string; if (stringHtmlParam != null) { SafeNativeMethods.HtmlHelp(handle, pathAndFileName, htmlCommand, stringHtmlParam); } else if (htmlParam is int) { SafeNativeMethods.HtmlHelp(handle, pathAndFileName, htmlCommand, (int)htmlParam); } else if (htmlParam is NativeMethods.HH_FTS_QUERY) { SafeNativeMethods.HtmlHelp(handle, pathAndFileName, htmlCommand, (NativeMethods.HH_FTS_QUERY)htmlParam); } else if (htmlParam is NativeMethods.HH_AKLINK) { // According to MSDN documentation, we have to ensure that the help window is up // before we call ALINK lookup. // SafeNativeMethods.HtmlHelp(NativeMethods.NullHandleRef, pathAndFileName, HH_DISPLAY_TOPIC, (string)null); SafeNativeMethods.HtmlHelp(handle, pathAndFileName, htmlCommand, (NativeMethods.HH_AKLINK)htmlParam); } else { Debug.Fail("Cannot handle HTML parameter of type: " + htmlParam.GetType()); SafeNativeMethods.HtmlHelp(handle, pathAndFileName, htmlCommand, (string)param); } } else if (param == null) { SafeNativeMethods.HtmlHelp(handle, pathAndFileName, MapCommandToHTMLCommand(command, null, out htmlParam), 0); } else if (param is NativeMethods.HH_POPUP) { SafeNativeMethods.HtmlHelp(handle, pathAndFileName, HH_DISPLAY_TEXT_POPUP, (NativeMethods.HH_POPUP)param); } else if (param.GetType() == typeof(int)) { throw new ArgumentException(string.Format(SR.InvalidArgument, "param", "Integer")); } }