Asynchronous sockets with ALLEGRO_EVENT_QUEUE
Addison Elliott

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

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

Cool, could that be used for menus as well?

Matthew Leverton
Thread #607712. Printed from Allegro.cc