怎样得到硬盘分了几个区 以及得到分区的盘符

解决方案 »

  1.   

    可以试试GetDriverType这个函数。主要功能是指定一个盘符,返回这个盘符是软盘、可移
    动盘、硬盘、光盘等信息,具体如何使用请看帮助 
    比如:
    for i:=65 to 90 do
    begin
       j := GetDriverType(chr(i));
       检测j的返回值,
       返回值具体看帮助吧。
    end;
      

  2.   

    GetDriverType()
    返回值 含义
    0 The drive type cannot be determined.
    1 The root directory does not exist.
    DRIVE_REMOVABLE The drive can be removed from the drive.
    DRIVE_FIXED The disk cannot be removed from the drive.
    DRIVE_REMOTE The drive is a remote (network) drive.
    DRIVE_CDROM The drive is a CD-ROM drive.
    DRIVE_RAMDISK The drive is a RAM disk.如GetDriverType('c:\');
      

  3.   

    其中下面这个是硬盘
    DRIVE_FIXED The disk cannot be removed from the drive.检测到一个,硬盘分区计数器累加一个。
    最后从a到z循环结束,看计数器的值就是分区数,同时也知道那个盘符了。