开发者

Outlook 2003 vsto Add-in Categorize dialog opens behind new mail window

开发者 https://www.devze.com 2023-02-21 00:28 出处:网络
I have created C# add-in for Outlook 2003. Add-in creates a command开发者_如何学Go bar in new mail form. This command bar contains a button that opens a Categorize dialog.

I have created C# add-in for Outlook 2003. Add-in creates a command开发者_如何学Go bar in new mail form. This command bar contains a button that opens a Categorize dialog. To open the dialog I use ShowCategoriesDialog method of MailItem Interface.

Microsoft.Office.Interop.Outlook.MailItem item = (MailItem)inspector.CurrentItem;
item.ShowCategoriesDialog();

It works fine, but in several machines categorize window opens behind the new mail window.

Do you know how to fix it?

Thank you very much,

Andriy Kozachuk


Two ways I can think off offhand.

1)try some combination of minimizing and restoring the Inspector that you have a reference to (Inspector.WindowState), possibly min, restore, showcat, or min/showcat/restore Not a great solution because it will cause some flashing. 2) if you're doing this from within an event that is causing the inspector to be shown, you may not have let the inspect get completely realized. In that case, use a timer or background thread to delay showing the cat window for a bit (this is a bit hackish though). 3) use the Windows API EnumWindows to find the Categories window, and use SetWindowPos to bring it back to the top of the zorder. (probably the better solution).

I've run into this very sort of problem with Outlook on many occasions, though not this specific instance of it.

0

精彩评论

暂无评论...
验证码 换一张
取 消