2
添加下一個變化:如何創建處理
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: '艾米莉:: AsyncSocketController :: onDataArrival ::添加':不能轉換參數1 'AC_WebPassManager :: Form1中::^DataArrival事件'到'Emily :: AsyncSocketController :: onDataArrivalEventHandler ^' 1>沒有用戶定義的轉換運算符可用,或者 1>指向的類型是不相關的;轉換要求reinterpret_cast,C樣式轉換或函數樣式轉換 1>
好的,我更改了代碼 Emily :: oSeMac^Terminal; Emily :: AsyncSocketController^_socketManager; public:delegate DataArrival(String ^,array ^,System :: Net :: IPEndPoint ^); void _socketManager_onDataArrival(String^SocketID,array ^SocketData,System :: Net :: IPEndPoint^RemoteIP) \t \t { System :: Object^retData = Terminal-> WhoCame(SocketID,SocketData,RemoteIP ,_socketManager,0); \t \t} –
user372145
2010-06-21 13:03:52
Form1中(空隙) \t \t { \t \t \t的InitializeComponent(); \t \t \t _socketManager = gcnew Emily :: AsyncSocketController(2000); \t \t \t _socketManager-> onDataArrival + = gcnew DataArrival(this,&AC_WebPassManager :: Form1 :: _ socketManager_onDataArrival); \t \t \t _socketManager-> Start(); \t \t \t Terminal = gcnew Emily :: oSeMac(); \t \t} – user372145 2010-06-21 13:04:38
錯誤 1> d:\ projects \ ac_webpassmanager \ ac_webpassmanager \ Form1.h(36):錯誤C2146:語法錯誤:缺少';'在標識符'DataArrival'之前1> d:\ projects \ ac_webpassmanager \ ac_webpassmanager \ Form1.h(36):錯誤C4430:缺少類型說明符 - 假定爲int。注意:C++不支持default-int 1> d:\ projects \ ac_webpassmanager \ ac_webpassmanager \ Form1.h(36):錯誤C4430:缺少類型說明符 - 假定爲int。注意:C++不支持default-int 1> d:\ projects \ ac_webpassmanager \ ac_webpassmanager \ Form1.h(36): – user372145 2010-06-21 13:05:46