[]
C1Command’s Menus and Toolbars rely on installing a message filter (implementing the IMessageFilter interface) to implement main menu and some other functionality. In some cases (for example, when C1Command is used in a component's designer, and is run in Visual Studio's design time), installing a message filter does not work. In such cases, C1Command can still be used.
The following code fragment demonstrates how to show a dialog box when a message filter could not be installed. You can use this approach, for example, if you want to show a dialog box in your component's designer.
To write code in Visual Basic
Imports C1.Win.C1Command;
C1CommandHolder.UninstallMessageFilter()
'Create the C1CommandMsgHook
Dim hook As New C1CommandMsgHook()
hook.Install()
Try
result = dialog.ShowDialog()
Finally
Hook.Uninstall();
End Try
To write code in C#
using C1.Win.C1Command;
...
C1CommandHolder.UninstallMessageFilter();
C1CommandMsgHook hook = new C1CommandMsgHook();
hook.Install();
try
{
result = dialog.ShowDialog();
}
finally
{
hook.Uninstall();
}