CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2008
    Posts
    10

    PnP notification issue

    I'm working with a USB thermal printer that we manufacture. I'm trying to make it PnP compatible and can't seem to be able to capture the DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE notifications. I'm using a third party library but have traced through the code and can see that the printer is being registered properly for the notifications:
    Code:
    DEV_BROADCAST_DEVICEINTERFACE Filter;
    ZeroMemory(&Filter, sizeof(Filter) );
    Filter.dbcc_size = sizeof(Filter);
    Filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
    Filter.dbcc_classguid = Notification->InterfaceClassGuid; // struct copy
    Notification->hDevNotify = ::RegisterDeviceNotification(
     hwnd, 
     &Filter,
     DEVICE_NOTIFY_WINDOW_HANDLE
    );
    I'm using the system-supplied GUID {4d36e979-e325-11ce-bfc1-08002be10318}. In my handler I see only WM_DEVICECHANGED messages with wParam set to DBT_DEVNODES_CHANGED and nothing else. I have used this library successfully for other devices (not printers).

    Thanks in advance for any input.

    Dave.

  2. #2
    Join Date
    Mar 2008
    Posts
    10

    Re: PnP notification issue

    The library uses a hidden window which registers and processes PnP messages. I've used Spy++ on this window and don't see any DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE notifications at all. Could they be swallowed up by the Windows USB Printing Support?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured