gpt4 book ai didi

.net - 如何创建处理程序

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:36:38 25 4
gpt4 key购买 nike

添加下一个更改:

Emily::oSeMac^ Terminal;
Emily::AsyncSocketController^ _socketManager;
delegate void DataArrival(String^, array<unsigned char, 1>^, System::Net::IPEndPoint^);

void _socketManager_onDataArrival(String^ SocketID, array<unsigned char, 1>^ SocketData, System::Net::IPEndPoint^ RemoteIP)
{
System::Object^ retData = Terminal->WhoCame (SocketID, SocketData, RemoteIP, _socketManager, 0);
}
Form1(void)
{
InitializeComponent();
_socketManager = gcnew Emily::AsyncSocketController(2000);
_socketManager->onDataArrival += gcnew DataArrival(this, &AC_WebPassManager::Form1::_socketManager_onDataArrival);
_socketManager->Start();
Terminal = gcnew Emily::oSeMac();
}

错误错误 C2664:“Emily::AsyncSocketController::onDataArrival::add”:无法将参数 1 从“AC_WebPassManager::Form1::DataArrival ^”转换为“Emily::AsyncSocketController::onDataArrivalEventHandler ^”1> 没有可用的用户定义转换运算符,或者1> 指向的类型不相关;转换需要 reinterpret_cast、C 风格转换或函数风格转换1>

最佳答案

_socketManager->onDataArrival += gcnew DataArrival(this,    &Test::Form1::_socketManager_onDataArrival_);

DataArrival 是委托(delegate):

public delegate DataArrival(String^, array<unsigned char, 1>^, System::Net::IPEndPoint^);

可能它已经在某处用其他名称定义了 - 请查看 Emily 命名空间中的委托(delegate)定义。

关于.net - 如何创建处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3084689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com