你的usb设备装driver了?driver注册设备的时候是指定为什么设备?

解决方案 »

  1.   

    你的usb设备装driver了?driver注册设备的时候是指定为什么设备?
      

  2.   

    谢谢,我测试了两种设备,一种有驱动,一种不需驱动,就是key,二者结果一样
      

  3.   

    你换U盘试试,WM_DEVICECHANGE这个消息,我们公司用过,没问题的
      

  4.   

    u盘可以,但不需要驱动的key反而不行,真是郁闷,请问,还有什么好办法吗?
      

  5.   

    你拿usbview看下,它的info是不是全
      

  6.   

    这是小弟测试用key的信息:
    Device Descriptor:
    bcdUSB:             0x0110
    bDeviceClass:         0x00
    bDeviceSubClass:      0x00
    bDeviceProtocol:      0x00
    bMaxPacketSize0:      0x08 (8)
    idVendor:           0x096E
    idProduct:          0x0302
    bcdDevice:          0x010A
    iManufacturer:        0x01
    iProduct:             0x02
    iSerialNumber:        0x00
    bNumConfigurations:   0x01ConnectionStatus: DeviceConnected
    Current Config Value: 0x01
    Device Bus Speed:      Low
    Device Address:       0x01
    Open Pipes:              0
      

  7.   

    小弟用usb鼠标测试,结果一样,鼠标的信息:
    Device Descriptor:
    bcdUSB:             0x0200
    bDeviceClass:         0x00
    bDeviceSubClass:      0x00
    bDeviceProtocol:      0x00
    bMaxPacketSize0:      0x08 (8)
    idVendor:           0x046D (Logitech Inc.)
    idProduct:          0xC019
    bcdDevice:          0x4301
    iManufacturer:        0x01
    iProduct:             0x02
    iSerialNumber:        0x00
    bNumConfigurations:   0x01ConnectionStatus: DeviceConnected
    Current Config Value: 0x01
    Device Bus Speed:      Low
    Device Address:       0x01
    Open Pipes:              1Endpoint Descriptor:
    bEndpointAddress:     0x81
    Transfer Type:   Interrupt
    wMaxPacketSize:     0x0005 (5)
    bInterval:            0x0A
    这个信息应该比较全了,除了以下三项:
    bDeviceClass:         0x00
    bDeviceSubClass:      0x00
    bDeviceProtocol:
      

  8.   

    我刚帮你看了下
    #define DBT_DEVNODES_CHANGED            0x0007WM_DEVICECHANGE
    The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.Event = (UINT) wParam;
    dwData = (DWORD) lParam;7代表的是:
    /*
     * Message = WM_DEVICECHANGE
     * wParam  = DBT_DEVNODES_CHANGED
     * lParam  = 0
     *
     *      send when configmg finished a process tree batch. Some devnodes
     *      may have been added or removed. This is used by ring3 people which
     *      need to be refreshed whenever any devnode changed occur (like
     *      device manager). People specific to certain devices should use
     *      DBT_DEVICE* instead.
     */
      

  9.   

    谢谢。那我要知道设备插入或拔出,需要怎么设置呢?用DBT_DEVICEARRIVE能判出来吗?
      

  10.   

    这个,你要去看下lParam这个变量了