Gets the handle for this window.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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 example also demonstrates overriding the OnHandleChange method to be notified when the changes.
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 CreateHandle method and override the WndProc method to intercept window messages that are received. Although the example looks for the WM_ACTIVATEAPP message, this could 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.