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

Commit 1459fc0

Browse files
committed
Add UnregisterClass method
Closes #451
1 parent e70ad5a commit 1459fc0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/User32/User32.cs

+21
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,27 @@ public static extern unsafe int QueryDisplayConfig(
16871687
[return: MarshalAs(UnmanagedType.U2)]
16881688
public static extern short RegisterClassEx(ref WNDCLASSEX lpwcx);
16891689

1690+
/// <summary>
1691+
/// Unregisters a window class, freeing the memory required for the class.
1692+
/// </summary>
1693+
/// <param name="lpClassName">
1694+
/// A null-terminated string or a class atom. If lpClassName is a string, it specifies the window class name.
1695+
/// This class name must have been registered by a previous call to the <see cref="RegisterClass"/> or <see cref="RegisterClassEx"/> function.
1696+
/// System classes, such as dialog box controls, cannot be unregistered.
1697+
/// 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.
1698+
/// The atom must be in the low-order word of lpClassName; the high-order word must be zero.
1699+
/// </param>
1700+
/// <param name="hInstance">A handle to the instance of the module that created the class.</param>
1701+
/// <returns>
1702+
/// If the function succeeds, the return value is nonzero.
1703+
/// 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"/>.
1704+
/// </returns>
1705+
[DllImport(nameof(User32), SetLastError = true, CharSet = CharSet.Unicode)]
1706+
[return: MarshalAs(UnmanagedType.Bool)]
1707+
public static extern bool UnregisterClass(
1708+
string lpClassName,
1709+
IntPtr hInstance);
1710+
16901711
/// <summary>
16911712
/// Retrieves the name of the format from the clipboard.
16921713
/// </summary>

0 commit comments

Comments
 (0)