[SDL] lParam in SysWMmsg

paccy at t-online.de paccy at t-online.de
Sun Feb 13 14:09:37 PST 2005


 Hi,

I got a problem with msgtype WM_DEVICECHANGE,
following code should work:

#ifdef WINDOWS
          PDEV_BROADCAST_HDR dbh;

          case SDL_SYSWMEVENT:
            if (event.syswm.msg!=NULL) {
              if (event.syswm.msg->msg==WM_DEVICECHANGE) {              
 
                dbh=(PDEV_BROADCAST_HDR)  event.syswm.msg->lParam;
                  if (event.syswm.msg->wParam==DBT_DEVICEREMOVECOMPLETE)
{
                    if (dbh->dbch_devicetype==DBT_DEVTYP_VOLUME) {
                      sys->systemOut("CD OUT");
                    }
                  }
                  if (event.syswm.msg->wParam==DBT_DEVICEARRIVAL) {
                    if (dbh->dbch_devicetype==DBT_DEVTYP_VOLUME) {
                      sys->systemOut("CD IN");
                    }
                  }
              }                                       
            }
          break;
#endif //windows       

wParam works find, but the lParam doesn't seem to be the right pointer
to
the DEV_BROADCAST_HEADER. dbh->devicetype seems to be another
pointer rather than a DEVTYP (0,1,2 and so on).
Maybe my fault or GCC 3.4 ?

Regards,
  Thomas Omilian







More information about the SDL mailing list