// usbTest.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <tchar.h>
#include <string>
#include <iostream>
#include <Windows.h>
using namespace std;
#include <dbt.h>
/*------------------------------------------------------------------
FirstDriveFromMask( unitmask )
Description
Finds the first valid drive letter from a mask of drive letters.
The mask must be in the format bit 0 = A, bit 1 = B, bit 2 = C,
and so on. A valid drive letter is defined when the
corresponding bit is set to 1.
从一个驱动器字母的面具中找到第一个有效的驱动器字母。
这个掩码必须在格式位0=A,位1=B,位2=C,
等等。一个有效的驱动器字母是在
对应位设置为1。
Returns the first drive letter that was found.
--------------------------------------------------------------------*/
char FirstDriveFromMask(ULONG unitmask)
{
char i;
for (i = 0; i < 26; ++i)
{
if (unitmask & 0x1)
break;
unitmask = unitmask >> 1;
}
return(i + 'A');
}
/*
每个窗口会有一个称为窗口过程的回调函数(WndProc),它带有四个参数,分别为:
窗口句柄(Win
C++ 实现usb插入操作监控
最新推荐文章于 2025-07-26 16:09:40 发布
