Table of Contents

Class WindowsMessageBoxManager

Namespace
VisioForge.Core
Assembly
VisioForge.Core.dll

Provides functionality to customize MessageBox button text on a per-thread basis using Windows hooks. This class allows localization or customization of standard MessageBox buttons (OK, Cancel, Yes, No, etc.).

public class WindowsMessageBoxManager

Inheritance

Inherited Members

Remarks

This manager works by intercepting Windows messages using SetWindowsHookEx and modifying button text when a MessageBox dialog is initialized. Each thread that requires customization must call VisioForge.Core.WindowsMessageBoxManager.Register before showing MessageBoxes and VisioForge.Core.WindowsMessageBoxManager.Unregister when done.

Fields

Abort

Gets or sets the text for the Abort button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&Abort".

public static string Abort

Field Value

string

Cancel

Gets or sets the text for the Cancel button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&Cancel".

public static string Cancel

Field Value

string

Ignore

Gets or sets the text for the Ignore button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&Ignore".

public static string Ignore

Field Value

string

No

Gets or sets the text for the No button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&No".

public static string No

Field Value

string

OK

Gets or sets the text for the OK button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&OK".

public static string OK

Field Value

string

Retry

Gets or sets the text for the Retry button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&Retry".

public static string Retry

Field Value

string

Yes

Gets or sets the text for the Yes button in MessageBox dialogs. The ampersand (&) character indicates the keyboard accelerator. Default value is "&Yes".

public static string Yes

Field Value

string

Methods

Register()

Enables MessageBoxManager functionality on the current thread by installing a Windows hook.

public static void Register()

Remarks

MessageBoxManager functionality is enabled on current thread only. Each thread that needs MessageBoxManager functionality has to call this method. Call VisioForge.Core.WindowsMessageBoxManager.Unregister when MessageBox customization is no longer needed.

Exceptions

NotSupportedException

Thrown if a hook is already registered for the current thread.

Unregister()

Disables MessageBoxManager functionality on the current thread by removing the Windows hook.

public static void Unregister()

Remarks

Disables MessageBoxManager functionality on current thread only. This method should be called when MessageBox customization is no longer needed to free system resources.