Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call Correct HtmlHelp Overload #12511

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ HideCaret
HitTestThemeBackground
HT*
HTML_HELP_COMMAND
HtmlHelp
HTREEITEM
IAccessible
IAccessibleEx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.InteropServices;
using Windows.Win32.Data.HtmlHelp;

namespace Windows.Win32;

internal static partial class PInvoke
{
internal static unsafe HWND HtmlHelp(HWND hwndCaller, string? pszFile, HTML_HELP_COMMAND uCommand, nuint dwData)
/// <inheritdoc cref="HtmlHelp(HWND, string, HTML_HELP_COMMAND, nuint)" />
internal static unsafe HWND HtmlHelp<T>(T hwndCaller, string? pszFile, HTML_HELP_COMMAND uCommand, nuint dwData)
where T : IHandle<HWND>
{
// Copied from generated code pending resolution of https://github.com/microsoft/win32metadata/issues/1749

fixed (char* p = pszFile)
{
HWND __retVal = LocalExternFunction(hwndCaller, p, (uint)uCommand, dwData);
return __retVal;
}

[DllImport(Libraries.Hhctrl, ExactSpelling = true, EntryPoint = "HtmlHelpW")]
static extern HWND LocalExternFunction(HWND hwndCaller, PCWSTR pszFile, uint uCommand, nuint dwData);
HWND result = HtmlHelp(hwndCaller.Handle, pszFile, uCommand, dwData);
GC.KeepAlive(hwndCaller.Wrapper);
return result;
}

/// <inheritdoc cref="HtmlHelp(HWND, string, HTML_HELP_COMMAND, nuint)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static unsafe void ShowHTML10Help(Control? parent, string? url, HelpNavi
}
else if (htmlParam is int intParam)
{
PInvoke.HtmlHelp(handle, pathAndFileName, htmlCommand, in intParam);
PInvoke.HtmlHelp(handle, pathAndFileName, htmlCommand, (nuint)intParam);
}
else if (htmlParam is HH_FTS_QUERY query)
{
Expand Down