System.Windows.Forms.MessageBoxManager.Register C# (CSharp) Method

Register() public static method

Enables MessageBoxManager functionality
MessageBoxManager functionality is enabled on current thread only. Each thread that needs MessageBoxManager functionality has to call this method.
public static Register ( ) : void
return void
        public static void Register()
        {
            if (hHook != IntPtr.Zero)
                throw new NotSupportedException("One hook per thread allowed.");
            hHook = SetWindowsHookEx(WH_CALLWNDPROCRET, hookProc, IntPtr.Zero, AppDomain.GetCurrentThreadId());
        }

Usage Example

 static RtlMessageBox()
 {
     MessageBoxManager.Register();
 }