发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
typedef bool (CALLBACK *CareffReceive)(char *pBuf, int nBufSize);
CareffReceive m_Call ; //回复信息的回调函数
bool m_CallTrue=false;
extern "C"__declspec(dllexport)BOOL WINAPI CareffCallback(CareffReceive InfoReceive)
{
m_Call = InfoReceive;
//int i=1001;
//char * a = "hello";
//m_Call(a,i); //recv 为 char *, nLen 为 int
m_CallTrue=true;
return m_CallTrue;
//m_RecInfoCall(recv,nLen); //recv 为 char *, nLen 为 int
}
[DllImport("CDLLTools.dll", EntryPoint = "CareffCallback")]
static extern bool CareffCallback(CareffdelegateCall fa);
public delegate void CareffdelegateCall(string buf, int size);
public static void CareffDLLReturn(string sInfo, int iKey)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("CareffDLLReturn iKey=" + iKey.ToString() + ":sInfo=" + sInfo + "");
Console.ForegroundColor = ConsoleColor.White;
System.Threading.Thread.Sleep(1000);
return;
}
CareffCallback(CareffDLLReturn);
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。