Creates a window and its handle with the specified creation parameters.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The operating system ran out of resources when trying to create the native window.
The native Win32 API could not create the specified window.
The cp parameter specifies the values that are passed to the native Win32 CreateWindowEx method to create a window and its handle.
When the ClassName field is not a null reference (Nothing in Visual Basic), the newly created window handle inherits from the specified class. For example, if ClassName is set to BUTTON, the newly created window is based on the Win32 BUTTON window class. The Param property of the ClassName object must either be a null reference (Nothing in Visual Basic) or reference an instance of a class that was declared as a structure.
The class name provided is registered with the operating system.
The following code example demonstrates creating a window with a specific operating system window class name. The example creates a class that inherits from NativeWindow to accomplish this.
The MyNativeWindow class creates a new window with the ClassName set to BUTTON. This creates a Win32 button window. The location and size of the button is set, along with specifying additional window styles. The class demonstrates how to use the method and override the WndProc method to intercept window messages that are received. Although the example looks for the WM_ACTIVATEAPP message, this can be replaced in a real program with window messages specific to the type created.
Some control types send their window messages to the window parent instead of the window. See the Windows Platform SDK for more information.
for safe subwindows to call this method. Associated enumeration: UIPermissionWindow.SafeSubWindows
to create a top-level window. This permission is only demanded if the window style is not a child or if the window does not have a parent. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows