Method WndUtil.RegisterWindowClass
Overload
Registers new window class in this process.
public static void RegisterWindowClass(string className, WNDPROC wndProc = null, RWCEtc etc = null)
Parameters
className (string)
Class name. |
wndProc (WNDPROC)
Delegate of a window procedure. See Window Procedures. Use |
etc (RWCEtc)
Can be used to specify API WNDCLASSEX fields.
To set cursor use field mCursor (standard cursor) or hCursor (native handle of a custom cursor).
If |
Exceptions
ArgumentException
wndProc is an instance method. Must be static method or |
InvalidOperationException
The class already registered with this function and different wndProc (another method or another target object). |
Win32Exception
Failed, for example if the class already exists and was registered not with this function. |
Remarks
Calls API RegisterClassEx.
The window class is registered until this process ends. Don't need to unregister.
If called next time for the same window class, does nothing if wndProc is equal to the previous (or both null
). Then ignores etc. Throws exception if different.
Thread-safe.
Protects the wndProc delegate from GC.