首页 > 代码库 > windows 获取已插入U盘

windows 获取已插入U盘

static int GetUdisk(vector <CString> &udisk){    CHAR szDriveStrings[1024];    PCHAR szDriver;    memset(szDriveStrings, 0, sizeof(szDriveStrings));    GetLogicalDriveStrings(sizeof(szDriveStrings), szDriveStrings);    szDriver = szDriveStrings;    while (szDriver[0] != \0) {        if (GetDriveType(szDriver) == DRIVE_REMOVABLE) {            udisk.push_back(CString(szDriver));        }        szDriver += strlen(szDriver) + 1;    }    return 0;}