CreateWindow (user32)
Last changed:

The CreateWindow function creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window's parent or owner, if any, and the window's menu. To use extended window styles in addition to the styles supported by CreateWindow, use the CreateWindowEx function.

C# Signature:

[DllImport("user32.dll", SetLastError=true)]
static extern IntPtr CreateWindow(
       string lpClassName,
       string lpWindowName,
       uint dwStyle,
       int x,
       int y,
       int nWidth,
       int nHeight,
       IntPtr hWndParent,
       IntPtr hMenu,
       IntPtr hInstance,
       IntPtr lpParam);

VB Signature:

User-Defined Types:


Alternative Managed API:

Windows Forms (System.Windows)

Windows Presentation Foundation (System.Windows.Forms)



Tips & Tricks:

Sample Code: