WNDCLASS (Structures)
Last changed: jnm2-74.212.46.188

.
Summary
The WNDCLASSEX structure contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions. The WNDCLASSEX structure is similar to the 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.

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct WNDCLASSEX
{
   public uint cbSize;
   public ClassStyles style;
   [MarshalAs(UnmanagedType.FunctionPtr)]
   public WndProc lpfnWndProc;
   public int cbClsExtra;
   public int cbWndExtra;
   public IntPtr hInstance;
   public IntPtr hIcon;
   public IntPtr hCursor;
   public IntPtr hbrBackground;
   public string lpszMenuName;
   public string lpszClassName;
   public IntPtr hIconSm;
}

VB Definition:

<StructLayout(LayoutKind.Sequential)> _
Structure WNDCLASSEX
   Public cbSize As UInteger
   Public style As ClassStyles
   <MarshalAs(UnmanagedType.FunctionPtr)>
   Public lpfnWndProc As WndProc
   Public cbClsExtra As Integer
   Public cbWndExtra As Integer
   Public hInstance As IntPtr
   Public hIcon As IntPtr
   Public hCursor As IntPtr
   Public hbrBackground As IntPtr
   Public lpszMenuName As String
   Public lpszClassName As String
   Public hIconSm As IntPtr

   ' Use this function to make a new one with cbSize already filled in.
   ' For example:
   'Dim WndClss As WNDCLASSEX = WNDCLASSEX.GetNew()
   Shared Function MakeNew()
      Dim nw as New WNDCLASSEX
      nw.cbSize=Marshal.SizeOf(GetType(WNDCLASSEX))
      return nw
   End Function
End Structure

IMPORTANT:

The two strings were previously defined at pinvoke.net as:

<MarshalAs(UnmanagedType.LPTStr)> _
Public lpszMenuName As String
<MarshalAs(UnmanagedType.LPTStr)> _
Public lpszClassName As String

The MarshalAs attributes cause class registration to fail. They have been removed.

User-Defined Types:

WndProc, ClassStyles

Notes:

Documentation
WNDCLASSEX on MSDN