获得磁盘盘符ID

 DWORD Serial;
 DWORD Length;
 GetVolumeInformation("D:",NULL, MAX_PATH,&Serial,&Length, NULL,NULL,MAX_PATH);
 CString  StrSerial;
 StrSerial.Format("%ud",Serial);
 CFile logfile(_T("DiskID.log"), CFile::modeWrite|CFile::modeCreate);
 logfile.Write(StrSerial,StrSerial.GetLength());
 logfile.Flush();
 logfile.Close();

 

posted @ 2016-02-25 16:19  風行  阅读(221)  评论(0编辑  收藏  举报