[导入]这段时间都是搞那个华为的API
调用华为的DLL,我在网上找了一下都没有很理想的例子。这几天自己弄了一下。有了点结果。该DLL是C++写的。我用C#来调用成功了。下面是函数声明。
[DllImport("SMEIDll.dll")]
public extern static bool IFInitInterface(int dwCodeProtocol,int dwDriverProtocol,string pDriverParam);
[DllImport("SMEIDll.dll")]
public extern static bool IFExitInterface();
[DllImport("SMEIDll.dll")]
public extern static bool Login_R(string SystemID, string Password);
[DllImport("SMEIDLL.dll", CharSet=CharSet.Ansi)]
protected static extern int SubmitAExEx(
[MarshalAs(UnmanagedType.U1)] byte OrgTON,
[MarshalAs(UnmanagedType.U1)] byte OrgNPI,
[MarshalAs(UnmanagedType.LPStr)] string OrgAddr,
[MarshalAs(UnmanagedType.U1)] byte DestTON,
[MarshalAs(UnmanagedType.U1)] byte DestNPI,
[MarshalAs(UnmanagedType.LPStr)] string DestAddr,
[MarshalAs(UnmanagedType.U1)] byte PRI,
[MarshalAs(UnmanagedType.U1)] byte RD,
[MarshalAs(UnmanagedType.U1)] byte RP,
[MarshalAs(UnmanagedType.U1)] byte SRR,
[MarshalAs(UnmanagedType.U1)] byte MR,
[MarshalAs(UnmanagedType.U1)] byte DCS,
[MarshalAs(UnmanagedType.U1)] byte PID,
[MarshalAs(UnmanagedType.LPStr)] string Schedule,
[MarshalAs(UnmanagedType.LPStr)] string Expire,
[MarshalAs(UnmanagedType.U4)] uint Default_ID,
[MarshalAs(UnmanagedType.U1)] byte UDHI,
[MarshalAs(UnmanagedType.U4)] uint UDLen,
[MarshalAs(UnmanagedType.LPStr)] string UserData,
[MarshalAs(UnmanagedType.LPStr)] string ServiceSubType,
[MarshalAs(UnmanagedType.U1)] ref char byMsgID,
[MarshalAs(UnmanagedType.U1)] byte byPKTotal,
[MarshalAs(UnmanagedType.U1)] byte byPKNumber,
[MarshalAs(UnmanagedType.U1)] byte byMsglevel,
[MarshalAs(UnmanagedType.U1)] byte byFeeUserType,
[MarshalAs(UnmanagedType.LPStr)] string sSPID,
[MarshalAs(UnmanagedType.LPStr)] string sFeeType,
[MarshalAs(UnmanagedType.LPStr)] string sFeeAddr,
[MarshalAs(UnmanagedType.LPStr)] string sFeeCode,
[MarshalAs(UnmanagedType.U1)] byte byUserNum,
[MarshalAs(UnmanagedType.LPStr)] string sDestAddrs,
[MarshalAs(UnmanagedType.I4)] out UInt32 SM_ID,
[MarshalAs(UnmanagedType.U1)] out char FCS);
[DllImport("SMEIDLL.dll", CharSet=CharSet.Ansi)]
protected static extern int GetDeliverSMExExEx(
out ulong sm_ID,
[MarshalAs(UnmanagedType.U1)] out byte DestTON,
[MarshalAs(UnmanagedType.U1)] out byte DestNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder DestAddr,
[MarshalAs(UnmanagedType.U1)] out byte OrgTON,
[MarshalAs(UnmanagedType.U1)] out byte OrgNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder OrgAddr,
[MarshalAs(UnmanagedType.U1)] out byte PRI,
[MarshalAs(UnmanagedType.U1)] out byte RP,
[MarshalAs(UnmanagedType.U1)] out byte UDHI,
[MarshalAs(UnmanagedType.U1)] out byte PID,
[MarshalAs(UnmanagedType.U1)] out byte DCS,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder TimeStamp,
out ulong UDLen,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder UserData,
[MarshalAs(UnmanagedType.U1)] out byte StatusReport,
[MarshalAs(UnmanagedType.U1)] out byte sMsgID,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sSubmitdate,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sDonedate,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sStatus,
int iDeliverAckResult);
文章来源:http://blog.csdn.net/boho/archive/2005/11/08/525022.aspx
[DllImport("SMEIDll.dll")]
public extern static bool IFInitInterface(int dwCodeProtocol,int dwDriverProtocol,string pDriverParam);
[DllImport("SMEIDll.dll")]
public extern static bool IFExitInterface();
[DllImport("SMEIDll.dll")]
public extern static bool Login_R(string SystemID, string Password);
[DllImport("SMEIDLL.dll", CharSet=CharSet.Ansi)]
protected static extern int SubmitAExEx(
[MarshalAs(UnmanagedType.U1)] byte OrgTON,
[MarshalAs(UnmanagedType.U1)] byte OrgNPI,
[MarshalAs(UnmanagedType.LPStr)] string OrgAddr,
[MarshalAs(UnmanagedType.U1)] byte DestTON,
[MarshalAs(UnmanagedType.U1)] byte DestNPI,
[MarshalAs(UnmanagedType.LPStr)] string DestAddr,
[MarshalAs(UnmanagedType.U1)] byte PRI,
[MarshalAs(UnmanagedType.U1)] byte RD,
[MarshalAs(UnmanagedType.U1)] byte RP,
[MarshalAs(UnmanagedType.U1)] byte SRR,
[MarshalAs(UnmanagedType.U1)] byte MR,
[MarshalAs(UnmanagedType.U1)] byte DCS,
[MarshalAs(UnmanagedType.U1)] byte PID,
[MarshalAs(UnmanagedType.LPStr)] string Schedule,
[MarshalAs(UnmanagedType.LPStr)] string Expire,
[MarshalAs(UnmanagedType.U4)] uint Default_ID,
[MarshalAs(UnmanagedType.U1)] byte UDHI,
[MarshalAs(UnmanagedType.U4)] uint UDLen,
[MarshalAs(UnmanagedType.LPStr)] string UserData,
[MarshalAs(UnmanagedType.LPStr)] string ServiceSubType,
[MarshalAs(UnmanagedType.U1)] ref char byMsgID,
[MarshalAs(UnmanagedType.U1)] byte byPKTotal,
[MarshalAs(UnmanagedType.U1)] byte byPKNumber,
[MarshalAs(UnmanagedType.U1)] byte byMsglevel,
[MarshalAs(UnmanagedType.U1)] byte byFeeUserType,
[MarshalAs(UnmanagedType.LPStr)] string sSPID,
[MarshalAs(UnmanagedType.LPStr)] string sFeeType,
[MarshalAs(UnmanagedType.LPStr)] string sFeeAddr,
[MarshalAs(UnmanagedType.LPStr)] string sFeeCode,
[MarshalAs(UnmanagedType.U1)] byte byUserNum,
[MarshalAs(UnmanagedType.LPStr)] string sDestAddrs,
[MarshalAs(UnmanagedType.I4)] out UInt32 SM_ID,
[MarshalAs(UnmanagedType.U1)] out char FCS);
[DllImport("SMEIDLL.dll", CharSet=CharSet.Ansi)]
protected static extern int GetDeliverSMExExEx(
out ulong sm_ID,
[MarshalAs(UnmanagedType.U1)] out byte DestTON,
[MarshalAs(UnmanagedType.U1)] out byte DestNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder DestAddr,
[MarshalAs(UnmanagedType.U1)] out byte OrgTON,
[MarshalAs(UnmanagedType.U1)] out byte OrgNPI,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder OrgAddr,
[MarshalAs(UnmanagedType.U1)] out byte PRI,
[MarshalAs(UnmanagedType.U1)] out byte RP,
[MarshalAs(UnmanagedType.U1)] out byte UDHI,
[MarshalAs(UnmanagedType.U1)] out byte PID,
[MarshalAs(UnmanagedType.U1)] out byte DCS,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder TimeStamp,
out ulong UDLen,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder UserData,
[MarshalAs(UnmanagedType.U1)] out byte StatusReport,
[MarshalAs(UnmanagedType.U1)] out byte sMsgID,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sSubmitdate,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sDonedate,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder sStatus,
int iDeliverAckResult);
文章来源:http://blog.csdn.net/boho/archive/2005/11/08/525022.aspx