您好,登錄后才能下訂單哦!
這篇文章主要講解了“c++函數(shù)轉(zhuǎn)c#函數(shù)的代碼怎么寫”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“c++函數(shù)轉(zhuǎn)c#函數(shù)的代碼怎么寫”吧!
代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace FDEP
{
/// <summary>
/// 羅旭成
/// 深證通函數(shù)轉(zhuǎn)換
/// </summary>
public class ImportDLL
{
#region * 常量定義
//*****************************************************************
//協(xié)議類型常量
//名稱 定義值 說明
//MR_PROTOCOLTYPE_MRSTANDAND 0x01 FDEP規(guī)定的標(biāo)識(shí)業(yè)務(wù)協(xié)議
//MR_PROTOCOLTYPE_SELFCUSTOM 0xFF 用戶自定義協(xié)議類型
/// <summary>
/// 協(xié)議類型常量
/// </summary>
public const uint MR_PROTOCOLTYPE_MRSTANDAND = 0x01; // SBSP標(biāo)準(zhǔn)業(yè)務(wù)協(xié)議。
public const uint MR_PROTOCOLTYPE_SELFCUSTOM = 0xFF; // 用戶自定義協(xié)議類型。
//*****************************************************************
//消息標(biāo)識(shí)位常量
//名稱 定義值 說明
//MR_MSGFLAG_PERSIST 0x01 持久消息標(biāo)志,用于可靠傳輸。目前暫不支持
//MR_MSGFLAG_COMPRESS 0x02 壓縮標(biāo)志,需進(jìn)行壓縮傳輸
/// <summary>
/// 消息標(biāo)志位常量
/// </summary>
public const uint MR_MSGFLAG_PERSIST = 0x01; // 持久消息標(biāo)志,用于可靠傳輸。
public const uint MR_MSGFLAG_COMPRESS = 0x02; // 壓縮標(biāo)志,需進(jìn)行壓縮傳輸。
//*****************************************************************
//長度常量
//名稱 定義值 說明
//MR_MAXLEN_ADDR 64 用戶標(biāo)識(shí)及應(yīng)用標(biāo)識(shí)的最大長度
//MR_MAXLEN_PKGID 64 消息包標(biāo)識(shí)的最大長度
//MR_MAXLEN_USERDATA 256 用戶保留數(shù)據(jù)的最大長度
//MR_FIXLEN_EXPIREDABSTIME 20 過期絕對(duì)時(shí)間固定長度
/// <summary>
/// 消息標(biāo)志位常量
/// </summary>
public const int MR_MAXLEN_ADDR = 64; // 用戶標(biāo)識(shí)及應(yīng)用標(biāo)識(shí)的最大長度。
public const int MR_MAXLEN_PKGID = 64; // 消息包標(biāo)識(shí)的最大長度。
public const int MR_MAXLEN_USERDATA = 256; // 用戶保留數(shù)據(jù)的最大長度。
public const int MR_FIXLEN_EXPIREDABSTIME = 20; // 過期絕對(duì)時(shí)間固定長度。
//*****************************************************************
//函數(shù)返回錯(cuò)誤值
//MR_ERRCODE_OK 0
//MR_ERRCODE_PARAMERR -1
//MR_ERRCODE_CONNERR -2
//MR_ERRCODE_TIMEEXPIRED -3
//MR_ERRCODE_TIMEOUT -4
//MR_ERRCODE_NOMSG -5
//MR_ERRCODE_BUFTOOSHORT -6
//MR_ERRCODE_BUFTOOBIG -7
//MR_ERRCODE_SYSERROR -8
#endregion
#region * 結(jié)構(gòu)體的定義
/// <summary>
/// 用來表示一條消息的各種屬性
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct STUsgProperty
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_ADDR)]
public string m_szSourceUserID;//MR_MAXLEN_ADDR 源用戶標(biāo)識(shí),以“\0”結(jié)尾的字符串
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_ADDR)]
public string m_szSourceAppID;//MR_MAXLEN_ADDR 源應(yīng)用標(biāo)識(shí),以“\0”結(jié)尾的字符串
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_ADDR)]
public string m_szDestUserID;//MR_MAXLEN_ADDR 目的用戶標(biāo)識(shí),以“\0”結(jié)尾的字符串
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_ADDR)]
public string m_szDestAppID;//MR_MAXLEN_ADDR 目的應(yīng)用標(biāo)識(shí),以“\0”結(jié)尾的字符串
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_PKGID)]
public string m_szPkgID;//MR_MAXLEN_PKGID 消息包的包標(biāo)識(shí),以“\0”結(jié)尾的字符串,或者由用戶調(diào)用MrCreatePkgID函數(shù)生成,或者為空(即'\0')
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_PKGID)]
public string m_szCorrPkgID;//MR_MAXLEN_PKGID 相關(guān)包標(biāo)識(shí),以“\0”結(jié)尾的字符串,供用戶自用
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_USERDATA)]
public string m_szUserData1;//MR_MAXLEN_USERDATA 用戶數(shù)據(jù)1,以“\0”結(jié)尾的字符串,供用戶自用
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_MAXLEN_USERDATA)]
public string m_szUserData2;//MR_MAXLEN_USERDATA 用戶數(shù)據(jù)2,以“\0”結(jié)尾的字符串,供用戶自用
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MR_FIXLEN_EXPIREDABSTIME)]
public string m_szExpiredAbsTime;//MR_FIXLEN_EXPIREDABSTIME 該消息的過期時(shí)間,以“\0”結(jié)尾的字符串,格式為“YYYY-MM-DD HH:MM:SS”。也可以置空,此時(shí)如果目的用戶不在線,或者目的應(yīng)用未連接,則消息立即過期。
public byte m_ucFlag;//消息標(biāo)識(shí),有8個(gè)二進(jìn)制位組成,各位含義如下:位0 --為1表示持久消息,需可靠傳輸,暫不支持;
//位1 --為1表示消息需壓縮傳輸
public byte m_ucProtocolType;//協(xié)議類型標(biāo)識(shí),取值可以是下列之一:MR_PROTOCOLTYPE_MRSTANDAND 0x01 FDEP規(guī)定的標(biāo)準(zhǔn)業(yè)務(wù)協(xié)議
//MR_PROTOCOLTYPE_SELFCUSTOM 0xFF 用戶自定義協(xié)議類型
}
/// <summary>
/// 用來定義與接入客戶端建立連接所需的各種信息
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct STUConnInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
public string m_szMRIP;//接入客戶端消息路由器的IP地址,以"\0"結(jié)尾的字符串,格式為“xxx.xxx.xxx.xxx”
public UInt16 m_usMRPort;//接入客戶端消息路由器的連接端口
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
public string m_szMRIPBak;//備用消息路由器的IP地址,不設(shè)置備用消息路由器時(shí)可以為空
public UInt16 m_usMRPortBak;//備用消息路由器的連接端口,不設(shè)置備用消息路由器時(shí)可以為0
}
#endregion
#region * 函數(shù)的定義
/// <summary>
/// 定義的回調(diào)函數(shù)
/// </summary>
/// <param name="psPkg">要發(fā)送的消息包緩沖區(qū)</param>
/// <param name="iPkgLen">緩沖區(qū)中的消息包長度</param>
/// <param name="pMsgPropery">消息包屬性</param>
/// <param name="pvUserData">供回調(diào)函數(shù)使用的用戶數(shù)據(jù)</param>
/// <returns></returns>
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
public delegate int OnReceiveCallBack(string psPkg, int iPkgLen, ref STUsgProperty pMsgPropery, IntPtr pvUserData);
//typedef int (*OnReceiveCallBack)(const char* psPkg, int iPkgLen, const STUMsgProperty* pMsgPropery, void* pvUserData);
/// <summary>
/// 1.初始化,獲取相關(guān)資源,并嘗試與接入客戶端FDAP建立連接
/// </summary>
/// <param name="psAppID">本應(yīng)用的應(yīng)用標(biāo)識(shí)</param>[in]
/// <param name="psPasswd">本應(yīng)用在接入客服端設(shè)置的密碼,密碼必須與預(yù)設(shè)的匹配才能繼續(xù)</param>[in]
/// <param name="onReceive">接收到消息包時(shí)的回調(diào)函數(shù)</param>[in]
/// <param name="oConnInfo">接入客戶端連接信息</param>[in]
/// <param name="pvUserData">供回調(diào)函數(shù)使用的用戶數(shù)據(jù)</param>[in]
/// <returns>NULL 初始化失敗 非NULL 初始化成功,返回一個(gè)連接句柄,給句柄將作為其他函數(shù)調(diào)用的參數(shù)</returns>
[DllImport("mrapi.dll", EntryPoint = "MrInit", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrInit(string psAppID, string psPasswd, OnReceiveCallBack onReceive, STUConnInfo oConnInfo, IntPtr pvUserData);
//void* _stdcall MrInit(const char* psAppID, const char* psAppPasswd,OnReceiveCallBack onReceive,const STUConnInfo oConnInfo, void* pvUserData);
/// <summary>
/// 2.初始化,獲取相關(guān)資源,并嘗試與接入客戶端FDAP建立連接
/// </summary>
/// <param name="psUserCertID">本應(yīng)用的用戶標(biāo)識(shí)</param>[in]
/// <param name="psAppID">本應(yīng)用的應(yīng)用標(biāo)識(shí)</param>[in]
/// <param name="psPasswd">本應(yīng)用在接入客服端設(shè)置的密碼,密碼必須與預(yù)設(shè)的匹配才能繼續(xù)</param>[in]
/// <param name="onReceive">接收到消息包時(shí)的回調(diào)函數(shù)</param>[in]
/// <param name="oConnInfo">接入客戶端連接信息</param>[in]
/// <param name="pvUserData">供回調(diào)函數(shù)使用的用戶數(shù)據(jù)</param>[in]
/// <returns>NULL 初始化失敗 非NULL 初始化成功,返回一個(gè)連接句柄,給句柄將作為其他函數(shù)調(diào)用的參數(shù)</returns>
[DllImport("mrapi.dll", EntryPoint = "MrInit1", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrInit1(string psUserCertID, string psAppID, string psPasswd, OnReceiveCallBack onReceive, STUConnInfo oConnInfo, IntPtr pvUserData);
/// <summary>
/// 3.連接FDAP時(shí)的初始化函數(shù)。該函數(shù)對(duì)FDEAPI進(jìn)行初始化,分配獲取相關(guān)資源,并嘗試與接入客戶端建立通信連接
/// </summary>
/// <param name="pHandle">函數(shù)返回的句柄,該句柄將作為其他函數(shù)調(diào)用的參數(shù)</param>[out]
/// <param name="psUserCertID">本應(yīng)用的用戶標(biāo)識(shí)</param>[in]
/// <param name="psAppID">本應(yīng)用的應(yīng)用標(biāo)識(shí)</param>[in]
/// <param name="psPasswd">本應(yīng)用在接入客戶端設(shè)置的密碼,密碼必須與預(yù)設(shè)的匹配才能繼續(xù)</param>[in]
/// <param name="pMsgProperty">消息包屬性</param>[in]
/// <param name="onReceive">接收到消息包時(shí)的回調(diào)函數(shù)</param>[in]
/// <param name="oConnInfo">接入客戶端連接信息</param>[in]
/// <param name="pvUserData">供回調(diào)函數(shù)使用的用戶數(shù)據(jù)</param>[in]
/// <param name="iThreadCount">調(diào)用回頭函數(shù)OnReceive的線程數(shù)目</param>[in]
/// <returns>無</returns>
[DllImport("mrapi.dll", EntryPoint = "MrInit1Ex1", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrInit1Ex1(out IntPtr pHandle, string psUserCertID, string psAppID, string psPasswd, ref STUsgProperty pMsgProperty, OnReceiveCallBack onReceive, STUConnInfo oConnInfo, IntPtr pvUserData, int iThreadCount);
/// <summary>
/// 4.連接FDAP時(shí)的初始化函數(shù)。該函數(shù)對(duì)FDEAPI進(jìn)行初始化,分配獲取相關(guān)資源,并嘗試與接入客戶端建立通信連接
/// </summary>
/// <param name="pHandle">函數(shù)返回的句柄,該句柄將作為其他函數(shù)調(diào)用的參數(shù)</param>[out]
/// <param name="psAppID">本應(yīng)用的應(yīng)用標(biāo)識(shí)</param>[in]
/// <param name="psPassws">本應(yīng)用在接入客戶端設(shè)置的密碼,密碼必須與預(yù)設(shè)的匹配才能繼續(xù)</param>[in]
/// <param name="pOnRecvMsgPropery">這是回調(diào)函數(shù)OnReceive的接收條件,如果不需要任何條件,則可以填NULL</param>[in]
/// <param name="onReceive">接收到消息包時(shí)的回調(diào)函數(shù)</param>[in]
/// <param name="pConnInfo">接入客戶端連接信息</param>[in]
/// <param name="pvUserData">供回調(diào)函數(shù)使用的用戶數(shù)據(jù)</param>[in]
/// <param name="iThreadCount">調(diào)用回頭函數(shù)OnReceive的線程數(shù)目</param>
/// <returns>無</returns>
[DllImport("mrapi.dll", EntryPoint = "MrInit2", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrInit2(out IntPtr pHandle, string psAppID, string psPassws, ref STUsgProperty pOnRecvMsgPropery, OnReceiveCallBack onReceive, ref STUConnInfo pConnInfo, IntPtr pvUserData, int iThreadCount);
//void* _stdcall MrInit2(void** ppHandle, const char* psAppID, const char* psAppPasswd, STUMsgProperty* pOnRecvMsgPropery,OnReceiveCallBack onReceive,const STUConnInfo* pConnInfo, void* pvUserData, int iThreadCount);
/// <summary>
/// 5.判斷與交換中樞的連接是否正常
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>
/// <returns>0不正常 1正常</returns>
[DllImport("mrapi.dll", EntryPoint = "MrIsLinkOK", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrIsLinkOK(IntPtr pHandle);
//int _stdcall MrIsLinkOK(void* pHandle)
/// <summary>
/// 6.消息包標(biāo)識(shí)生成函數(shù)
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="szPkgID">生成的消息包標(biāo)識(shí)</param>[out]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrCreatePkgID", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrCreatePkgID(IntPtr pHandle, StringBuilder szPkgID);
//int _stdcall MrCreatePkgID(void* pHandle,char szPkgID[MR_MAXLEN_PKGID])
/// <summary>
/// 7.消息包發(fā)送函數(shù)
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="psPkg">要發(fā)送的消息包緩沖區(qū)</param>[in]
/// <param name="iPkgLen">緩沖區(qū)中的消息包長度</param>[in]
/// <param name="pMsgPropery">消息包屬性</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrSend", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrSend(IntPtr pHandle, string psPkg, int iPkgLen, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrSend(void* pHandle,const char* psPkg,int iPkgLen,STUsgProperty* pMsgPropery,int iMillSecTimeo);
/// <summary>
/// 8.消息包接收函數(shù)1
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="ppsPkg">雙指針,返回包所指向的內(nèi)存</param>[out]
/// <param name="piOutPkgLen">接收到消息包的實(shí)際長度</param>[out]
/// <param name="pMsgPropery">接收條件</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrReceive1", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrReceive1(IntPtr pHandle, out IntPtr ppsPkg, out int piOutPkgLen, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrReceive1(void* pHandle, char** ppsPkg, int* piOutPkgLen, STUMsgProperty* pMsgPropery, int iMillSecTimeo);
/// <summary>
/// 9.消息包內(nèi)存釋放函數(shù)
/// </summary>
/// <param name="psPkg">由MrReceivel1函數(shù)的第二個(gè)參數(shù)返回的指針</param>[in]
/// <returns>無</returns>
[DllImport("mrapi.dll", EntryPoint = "MrReceive1_FreeBuf", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrReceive1_FreeBuf(string psPkg);
//void _stdcall MrReceive1_FreeBuf(char* psPkg);
/// <summary>
/// 10.消息包瀏覽函數(shù)
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="piOutPkgLen">接收到消息包的實(shí)際長度</param>[out]
/// <param name="pMsgPropery">接收條件</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrBrowse", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrBrowse(IntPtr pHandle, out int piOutPkgLen, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrBrowse(void* pHandle, int* piOutPkgLen, STUMsgProperty* pMsgPropery, int iMillSecTimeo);
/// <summary>
/// 11.消息包接收函數(shù)2
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="ppsPkg">雙指針,返回包所指向的內(nèi)存</param>[out]
/// <param name="piOutPkgLen">接收到消息包的實(shí)際長度</param>[out]
/// <param name="iBufLenIn">消息包緩沖區(qū)大小</param>[out]
/// <param name="pMsgPropery">接收條件</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrReceive2", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrReceive2(IntPtr pHandle, out IntPtr ppsPkg, out int piOutPkgLen, out int iBufLenIn, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrReceive2(void* pHandle, char** ppsPkg, int* piOutPkgLen, int* iBufLenIn, STUMsgProperty* pMsgPropery, int iMillSecTimeo);
/// <summary>
/// 12.消息包接收函數(shù)3
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="ppsPkg">雙指針,返回包所指向的內(nèi)存</param>[out]
/// <param name="piOutPkgLen">接收到消息包的實(shí)際長度</param>[out]
/// <param name="piErrSXCode">交換錯(cuò)誤的原因碼</param>[out]
/// <param name="pMsgPropery">接收條件</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrReceive3", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrReceive3(IntPtr pHandle, out IntPtr ppsPkg, out int piOutPkgLen, out int piErrSXCode, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrReceive3(void* pHandle, char** ppsPkg, int* piOutPkgLen, int* piErrSXCode, STUMsgProperty* pMsgPropery, int iMillSecTimeo);
/// <summary>
/// 13.消息包接收函數(shù)4
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>[in]
/// <param name="ppsPkg">雙指針,返回包所指向的內(nèi)存</param>[out]
/// <param name="piOutPkgLen">接收到消息包的實(shí)際長度</param>[out]
/// <param name="piErrSXCode">交換錯(cuò)誤的原因碼</param>[out]
/// <param name="pMsgPropery">接收條件</param>[in/out]
/// <param name="iMillSecTimeo">以毫米為單位的接收最大超時(shí)時(shí)間</param>[in]
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrReceive4", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrReceive4(IntPtr pHandle, out IntPtr ppsPkg, out int piOutPkgLen, out int piErrSXCode, ref STUsgProperty pMsgPropery, int iMillSecTimeo);
//int _stdcall MrReceive4(void* pHandle, char** ppsPkg, int* piOutPkgLen, int* piErrSXCode, STUMsgProperty* pMsgPropery, int iMillSecTimeo);
/// <summary>
/// 14.釋放資源
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值</param>
/// <returns>無</returns>
[DllImport("mrapi.dll", EntryPoint = "MrDestroy", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr MrDestroy(IntPtr pHandle);
//void _stdcall MrDestroy(void* pHandle)
/// <summary>
/// 15.取得本API的版本號(hào)
/// </summary>
/// <param name="psBufVersion">返回的版本號(hào)</param>
/// <param name="iBufLen">版本號(hào)長度</param>
/// <returns>無</returns>
[DllImport("mrapi.dll", EntryPoint = "MrGetVersion", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern IntPtr MrGetVersion(StringBuilder psBufVersion, int iBufLen);
//void _stdcall MrGetVersion(char* psBufVersion,int iBufLen);
/// <summary>
/// 16.注冊(cè)包下推條件
/// </summary>
/// <param name="pHandle">連接句柄,調(diào)用MrInit時(shí)返回的值<</param>
/// <param name="pMsgPropery">消息的結(jié)構(gòu)實(shí)體</param>
/// <param name="iType">0 增加一個(gè)條件 1 刪除一個(gè)條件 2 清空所有條件</param>
/// <returns>0 成功 其他 失敗</returns>
[DllImport("mrapi.dll", EntryPoint = "MrRegRecvCondition", CallingConvention = CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Ansi)]
public static extern int MrRegRecvCondition(IntPtr pHandle, ref STUsgProperty pMsgPropery, int iType);
//int _stdcall MrRegRecvCondition(void* pHandle,STUMsgProperty* pMsgPropery,int iType);
#endregion
}
}
感謝各位的閱讀,以上就是“c++函數(shù)轉(zhuǎn)c#函數(shù)的代碼怎么寫”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)c++函數(shù)轉(zhuǎn)c#函數(shù)的代碼怎么寫這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。