现在在windows下编程,使用PC/SC函数对智能卡进行操作,但只有在智能卡被windows系统识别后,PC/SC函数才会有效。
而智能卡通过usb借口插上之后,需要一段时间才能被识别,即安装好驱动程序。
如何能达到当智能卡被识别之后,就运行我的函数呢?有什么消息吗?
How Do I Detect a Hardware Device Change?
It is very easy to detect this change, because the operating system will send a WM_DEVICECHANGE message to the application when a device change is detected. All we need to do is handle this message in the window procedure of the application.
From: Detecting USB Device Insertion and Removal Using Windows API <PDF>