Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Commit

Permalink
Add UnregisterClass method
Browse files Browse the repository at this point in the history
Closes #451
  • Loading branch information
AArnott committed Jun 14, 2020
1 parent e70ad5a commit fc85fff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/User32/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ static extern PInvoke.User32.SetThreadDpiHostingBehavior(PInvoke.User32.DPI_HOST
static extern PInvoke.User32.SetWindowText(System.IntPtr hWnd, string lpString) -> bool
static extern PInvoke.User32.ShowCursor(bool bShow) -> int
static extern PInvoke.User32.SystemParametersInfoForDpi(PInvoke.User32.SystemParametersInfoAction uiAction, int uiParam, void* pvParam, PInvoke.User32.SystemParametersInfoFlags fWinIni, int dpi) -> bool
static extern PInvoke.User32.UnregisterClass(string lpClassName, System.IntPtr hInstance) -> bool
static extern PInvoke.User32.mouse_event(PInvoke.User32.mouse_eventFlags dwFlags, int dx, int dy, int dwData, void* dwExtraInfo) -> void
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE -> System.IntPtr
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 -> System.IntPtr
Expand Down
21 changes: 21 additions & 0 deletions src/User32/User32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,27 @@ public static extern unsafe int QueryDisplayConfig(
[return: MarshalAs(UnmanagedType.U2)]
public static extern short RegisterClassEx(ref WNDCLASSEX lpwcx);

/// <summary>
/// Unregisters a window class, freeing the memory required for the class.
/// </summary>
/// <param name="lpClassName">
/// A null-terminated string or a class atom. If lpClassName is a string, it specifies the window class name.
/// This class name must have been registered by a previous call to the <see cref="RegisterClass"/> or <see cref="RegisterClassEx"/> function.
/// System classes, such as dialog box controls, cannot be unregistered.
/// If this parameter is an atom, it must be a class atom created by a previous call to the <see cref="RegisterClass"/> or <see cref="RegisterClassEx"/> function.
/// The atom must be in the low-order word of lpClassName; the high-order word must be zero.
/// </param>
/// <param name="hInstance">A handle to the instance of the module that created the class.</param>
/// <returns>
/// If the function succeeds, the return value is nonzero.
/// If the class could not be found or if a window still exists that was created with the class, the return value is zero. To get extended error information, call <see cref="Marshal.GetLastWin32Error"/>.
/// </returns>
[DllImport(nameof(User32), SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnregisterClass(
string lpClassName,
IntPtr hInstance);

/// <summary>
/// Retrieves the name of the format from the clipboard.
/// </summary>
Expand Down

0 comments on commit fc85fff

Please sign in to comment.