Message box location problem - Item Send Office 2003/Windows2000

Add-in Express™ Support Service
That's what is more important than anything else

Message box location problem - Item Send Office 2003/Windows2000
 
Brendon Colloty




Posts: 59
Joined: 2005-10-06
Hi again,

Sorry for the flood of posts but i've mostly got my add-in finished and am just dealing with the outsomce of testing on various Office/Windows combinations.

I'm handling the ItemSend event in Outlook and poooing up a dialog box asking the user if they want to perform a particular operation with the message that was just sent.

It works great on the combinations of OS and Office that I've tried apart from Office 2003 and Windows 2000.

In ths instance the mseeags box appears behind the New message Inspector window but in front of the explorer window. Unfortunately this means that unless the user knows where to look for the dialog it just appears that their message is stuck.

Any thoughts on this?

Thanks,

Brendon Colloty.
Posted 19 Oct, 2005 17:55:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7216
Joined: 2004-07-05
Brendon, try to show a message using the MessageBox function that is defined in the user32.dll. See code below to learn how it can be done (the C# code):

private const uint MB_OK = 0x00000000;
private const uint MB_OKCANCEL = 0x00000001;
private const uint MB_ABORTRETRYIGNORE = 0x00000002;
private const uint MB_YESNOCANCEL = 0x00000003;
private const uint MB_YESNO = 0x00000004;
private const uint MB_RETRYCANCEL = 0x00000005;
private const uint MB_CANCELTRYCONTINUE = 0x00000006;

private const uint MB_ICONHAND = 0x00000010;
private const uint MB_ICONQUESTION = 0x00000020;
private const uint MB_ICONEXCLAMATION = 0x00000030;
private const uint MB_ICONASTERISK = 0x00000040;
private const uint MB_USERICON = 0x00000080;
private const uint MB_ICONWARNING = MB_ICONEXCLAMATION;
private const uint MB_ICONERROR = MB_ICONHAND;
private const uint MB_ICONINFORMATION = MB_ICONASTERISK;
private const uint MB_ICONSTOP = MB_ICONHAND;

private const uint MB_DEFBUTTON1 = 0x00000000;
private const uint MB_DEFBUTTON2 = 0x00000100;
private const uint MB_DEFBUTTON3 = 0x00000200;
private const uint MB_DEFBUTTON4 = 0x00000300;

private const uint MB_APPLMODAL = 0x00000000;
private const uint MB_SYSTEMMODAL = 0x00001000;
private const uint MB_TASKMODAL = 0x00002000;
private const uint MB_HELP = 0x00004000;

private const uint MB_NOFOCUS = 0x00008000;
private const uint MB_SETFOREGROUND = 0x00010000;
private const uint MB_DEFAULT_DESKTOP_ONLY = 0x00020000;
private const uint MB_TOPMOST = 0x00040000;
private const uint MB_RIGHT = 0x00080000;
private const uint MB_RTLREADING = 0x00100000;
private const uint MB_SERVICE_NOTIFICATION = 0x00200000;

[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int MessageBox(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string lpText, [MarshalAs(UnmanagedType.LPWStr)] string lpCaption, uint uType);

private void adxOutlookEvents_ItemSend(object sender, AddinExpress.MSO.ADXOlItemSendEventArgs e)
{
MessageBox(IntPtr.Zero, "My Message", "My Caption",
MB_OK | MB_ICONASTERISK | MB_DEFBUTTON1 | MB_APPLMODAL | MB_TOPMOST);
}
Posted 20 Oct, 2005 07:35:16 Top
Brendon Colloty




Posts: 59
Joined: 2005-10-06
Thanks Sergey - that works freat,
:)
Posted 25 Oct, 2005 03:07:07 Top