Zesty
Zesty

Reputation: 3001

How can I raise an event when a new item is added to Devices and Printers?

Background:

I'm using a third-party library to read a smart card used as an ID card.

This library only supports a method to read the card. It doesn't throw events when the card is inserted into the reader. As a result, currently, I can only have the card read when a button is clicked. I want to remove this requirement of clicking.

Requirement:

When the ID card is inserted into the reader, the software automatically adds an item to "Devices and Printers" called "ID Card". How can I get a notification when this item is added?

Current findings:

This excellent answer successfully triggers an event when the USB reader is inserted into the computer. It does not, however, trigger an event when the card is inserted into the reader (even though it somehow appears in the "Devices and Printers" list.

This answer lists all the USB devices connected to the computer. It somehow lists more devices than are connected to the computer (8 when there are only 3 devices + the card). It also does not detect the card - the number remains the same whether or not the card is inserted into the reader.

How can I read this "Devices and Printers" list? And how can I detect when a new item is added to this list?

Upvotes: 0

Views: 93

Answers (0)

Related Questions