G
Groghz
Hi,
I'm pinvoking a mapi function in c#
[DllImport("cemapi.dll", SetLastError = true)]
public static extern int MailSwitchToAccount(string pszAccount,
UInt32 dwFlags);
I then call the function :
if (Mapi.MailSwitchToAccount("My_account",
Mapi.MCF_ACCOUNT_IS_NAME | Mapi.MCF_RUN_IN_BACKGROUND) != 0)
{
int err = Marshal.GetLastWin32Error();
Win32Exception ex = new Win32Exception(err);
Log("mapi", Severity.Error, "MailSwitchToAccount()
failed with win32error=" + ex.NativeErrorCode + ", ex.Message=" +
ex.Message);
}
The problem is MailSwitchToAccount never returns 0, and so a the error
handling code is executed. In the logs, the ex.NativeErrorCode is
always 0, which doesn't seem to be a valid error code.
Is there another way to find the error code ?
regards,
manu
I'm pinvoking a mapi function in c#
[DllImport("cemapi.dll", SetLastError = true)]
public static extern int MailSwitchToAccount(string pszAccount,
UInt32 dwFlags);
I then call the function :
if (Mapi.MailSwitchToAccount("My_account",
Mapi.MCF_ACCOUNT_IS_NAME | Mapi.MCF_RUN_IN_BACKGROUND) != 0)
{
int err = Marshal.GetLastWin32Error();
Win32Exception ex = new Win32Exception(err);
Log("mapi", Severity.Error, "MailSwitchToAccount()
failed with win32error=" + ex.NativeErrorCode + ", ex.Message=" +
ex.Message);
}
The problem is MailSwitchToAccount never returns 0, and so a the error
handling code is executed. In the logs, the ex.NativeErrorCode is
always 0, which doesn't seem to be a valid error code.
Is there another way to find the error code ?
regards,
manu