GetClassInfoEx (user32)
Last changed: -


C# Signature:

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetClassInfoEx(IntPtr hInstance, string lpClassName, ref WNDCLASSEX lpWndClass);

VB.NET Signature:

<DllImport("user32", SetLastError:=True)> _
Private Shared Function GetClassInfoEx(hInstance As IntPtr, lpClassName As String, ByRef lpWndClass As WNDCLASSEX) As Boolean
End Function

User-Defined Types:



Be sure to set cbSize member of WNDCLASSEX structure before calling the GetClassInfoEx function.

Tips & Tricks:

Please add some!

Sample Code:

IntPtr hinstance = Marshal.GetHINSTANCE(GetType().Module);
String className = "Required Class Name";
WNDCLASSEX wndClass = new WNDCLASSEX { cbSize = (uint)Marshal.SizeOf(typeof(WNDCLASSEX)) };

if (GetClassInfoEx(hinstance, className, ref wndClass))
   // Class exists

Alternative Managed API:

Do you know one? Please contribute it!