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!
The GetClassInfoEx API
1/27/2020 7:28:20 AM - -64.180.49.185
The '''WNDCLASSEX''' structure contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions. The '''WNDCLASSEX''' structure is similar to the Structures.[WNDCLASS] structure. There are two differences. '''WNDCLASSEX''' includes the '''cbSize''' member, which specifies the size of the structure, and the '''hIconSm''' member, which contains a handle to a small icon associated with the window class.