参考MSDN例子:Detecting Media Insertion or Removal
响应WM_DEVICECHANGE 消息:
BOOL OnDeviceChange( UINT nEventType, DWORD dwData )
{
PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)dwData; // struct transform
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
switch (nEventType)
{
case DBT_DEVNODES_CHANGED:
...
break;
case DBT_DEVICEARRIVAL: // device arrival
if(GetDriveType(UDriveName)==DRIVE_REMOVABLE)
{
........
}
else
{
.......[ 查看全文 ]