Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Asynchronous sockets with ALLEGRO_EVENT_QUEUE

This thread is locked; no one can reply to it. rss feed Print
Asynchronous sockets with ALLEGRO_EVENT_QUEUE
Addison Elliott
Member #12,394
November 2010

I just started working with asynchronous sockets today and noticed that the WSAAsyncSelect has a parameter of HWND to send events too. I am pretty sure there's a function to get the HWND handle from a ALLEGRO_DISPLAY, but not sure what would happen if I registered that :P

Does anyone know a way to get asynchronous sockets to emit events to a ALLEGRO_EVENT_QUEUE?

Matthew Leverton
Supreme Loser
January 1999
avatar

If you use the SVN version of Allegro you can use this after registering the hwnd:

bool net_event(ALLEGRO_DISPLAY *d, UINT msg, WPARAM w, LPARAM l)
{
  if (msg == WM_SOCKET)
  {
    // do something
    return true;
  }
  return false;
}

al_add_win_window_callback(display, net_event);

jmasterx
Member #11,410
October 2009

Cool, could that be used for menus as well?

Matthew Leverton
Supreme Loser
January 1999
avatar

Go to: