#include <windows.h> #include <stdlib.h> #include <stdio.h> #include <cstring> #define BUFSIZE 1024 int main(void) { CHAR buf[BUFSIZE]; PCHAR SzDrive; //CHAR的指针; CHAR myMessage[BUFSIZE]; GetLogicalDriveStrings(BUFSIZE-1,buf); SzDrive = (PCHAR)buf; DWORD dwLastErr; DWORD dwFileSystemFlags; while(GetDriveType(SzDrive) != DRIVE_CDROM) { SzDrive += (lstrlen(SzDrive)+1); } if(!GetVolumeInformation( SzDrive,NULL,0,NULL,NULL,&dwFileSystemFlags,buf,BUFSIZE )) { dwLastErr = GetLastError(); if(dwLastErr == 21) { MessageBox(NULL,"请放入光盘","提示",MB_OK); return 0; } } MessageBox(NULL,buf,"提示文件系统类别",MB_OK); return 0; }