Outlook 2003 vsto Add-in Categorize dialog opens behind new mail window
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 KozachukTwo 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.
精彩评论