用以下代码在ATL工程新建的service中的ServiceMain函数中注册了通知,没有错误日志,不知怎么接受消息
    DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
 
    ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
    NotificationFilter.dbcc_size = 
        sizeof(DEV_BROADCAST_DEVICEINTERFACE);

NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
    NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;    HANDLE hDevNotify = RegisterDeviceNotification( (HANDLE)m_hServiceStatus, 
        &NotificationFilter,
        1
    );    if(!hDevNotify) 
    { DWORD dwError=GetLastError();
LogEvent(_T("RegisterDeviceNotification failed: %u."),dwError);
        return ;
    }在run函数中用
MSG msg;
    while (GetMessage(&msg, 0, 0, 0))
{
if (msg.message)//仅仅用来监测是否有消息
{
LogEvent(_T("usb"));
continue;
}
if (WM_DEVICECHANGE==msg.message)
{
MessageBox(0,_T("usb"),NULL,MB_OK);
LogEvent(_T("usb"));
continue;
}        DispatchMessage(&msg);

}
没有收到过我的u盘插入删除消息
还有一个问题:如果接收到消息,如何得到插入u盘的盘符