how can i invoke MAPI32.DLL, and waht's wrong with my code
i write a application that can read mail,i use MAPI32.DLL,but there have a System.NullReferenceException Exception.what's wrong with my code,can you help me?
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
namespace test
{
public class Mail
{
public Mail()
{
}
[ DllImport( "MAPI32.DLL", SetLastError=true)]
public static extern long MAPILogon(long UIParam, string User, string Password, long Flags, long Reserved, out long Session);
public const int MAPI_FORCE_DOWNLOAD = 4096;
public static long LogOnMail(string User, string Password, out long Session)
{
return MAPILogon(0,User, Password,2,0, out Session);
}
}
}