I edited my question when I set the bounty. I want to Invoke/DllImport WSAAsyncSelect() from WinAPI and use it much like I use it in Delphi/C++
For example – Delphi
//Async CallBack handler Declaration procedure MessageHandler(var Msg:Tmessage);Message WM_WINSOCK_ASYNC_MSG; //Where i setup the Async dwError := WSAAsyncSelect(Sock, form1.handle, WM_WINSOCK_ASYNC_MSG, FD_CLOSE or FD_READ); //Async Callback Handler procedure Tform1.MessageHandler(var Msg:Tmessage); begin case WSAGetSelectEvent(MSG.LParam) of //LParam is FD_READ/FR_CLOSE/FD_WRITE FD_READ: OnSocketRead(MSG.WParam); //WPARAM is the Socket itself. FD_CLOSE: OnSocketClose(MSG.WParam); end; end;
Thanks in advance!
I made it! Finaly!!!
WSAAsyncSelect() structure
WS2 Class
WndProc in the Form class.
Get Handle: