Multuple DBT_DEVICEARRIVAL Messages?

Discussion in 'Windows Vista Drivers' started by bsnguy, Oct 24, 2007.

  1. bsnguy

    bsnguy Guest

    I appologize if there is a different newsgroup for this, but when trying to
    use my USB device driver, I seem to get one DBT_DEVICEARRIVAL the first time
    I plug in my device, two the second time, three the third, etc. Sometimes,
    it's not quite that pattern, but the more often I remove and reinsert, the
    more messages I get after the reinsertion.

    my code snippit looks like this:

    bcastHdr = (PDEV_BROADCAST_HDR) lParam;
    if (bcastHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
    if (_tcsstr(pInterface->dbcc_name,TEXT("Vid_1921&Pid_8001")) !=
    NULL) {
    // my device so initialize some stuff
    return TRUE;

    So am I doing something obviously stupid, here? Seems simple enough, but...

    If there are any thoughts as to why multiple arrival messages would be
    produced, don't hold back. I'm at wits end so could use some new ideas.

    bsnguy, Oct 24, 2007
    1. Advertisements

  2. perhaps you are not closing the previous notification handles when the
    device is removed or every time you receive a notificaiton of arrival you
    reregister. definitely an app bug though

    Doron Holan [MSFT], Oct 24, 2007
    1. Advertisements

  3. bsnguy

    dzar Guest

    I agree that this is my problem... when I looked at this and simply commented
    out all the things I do when I get a notification, the problem goes away. Why I
    didn't think of that sooner, I'll never know!

    Thanks for the things to look for... I'm on the hunt.

    dzar, Oct 24, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.