Detecting Drive Types

CK CK 3776 
Created at  
467 0 0
Here's how to get the types of drives on your computer:

//Note: you will need one button and

//one memo on your form, for this tip...

procedure TForm1.Button1Click(Sender: TObject) ;

var

  Drive: Char;

  DriveLetter: String[4];

begin

  for Drive := 'A' to 'Z' do

  begin

  DriveLetter := Drive + ':';

  case GetDriveType(PChar(Drive + ':')) of

   DRIVE_REMOVABLE:

    Memo1.Lines.Add(DriveLetter + ' Floppy Drive') ;

   DRIVE_FIXED:

    Memo1.Lines.Add(DriveLetter + ' Fixed Drive') ;

   DRIVE_REMOTE:

    Memo1.Lines.Add(DriveLetter + ' Network Drive') ;

   DRIVE_CDROM:

    Memo1.Lines.Add(DriveLetter + ' CD-ROM Drive') ;

   DRIVE_RAMDISK:

    Memo1.Lines.Add(DriveLetter + ' RAM Disk') ;

   end;

  end;

end;
Tags BlockInput DRIVE_CDROM DRIVE_FIXED DRIVE_RAMDISK DRIVE_REMOTE DRIVE_REMOVABLE GetDriveType chkdsk Facebook X
Comments 0
Similar posts
  1. Disable Mouse and Keyboard from Delphi Code
    787
  2. Detecting and preventing Windows shut down
    432
  3. Display Standard Windows Properties dialog
    1,125
  4. Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL
    1,819
  5. Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)
    411
  6. Controling sound volume from code
    417
  7. How to Close Another Application by Windows Caption
    384
  8. How to Change the Windows Start button bitmap
    421
  9. How to capture the output from a DOS (command/console) Window
    960
  10. How to Activate/Deactivate the Screen Saver
    855
  11. Get Windows Temp directory
    652
  12. How to Get Windows OS Version ?
    424
  13. How to Get Filenames from Clipboard ?
    1,500
  14. Get system info (free memory, etc)
    402
  15. Get dimensions of usable space on monitor (work area)
    486
  16. Get text from the control at pos x,y on screen
    464
  17. How to determine the output of a console application ?
    449
  18. How to install an INF file using Delphi ?
    460
  19. How to play sounds on the PC Speaker ?
    523
  20. How to remove your application from TaskBar
    655
  21. How to track a user's idle time
    587
  22. How to know whether the font is TrueTypeFont or not
    373
  23. List Devices (LPT, COM ports, ...)
    477
  24. How to restrict mouse movement
    405
  25. How to send char as message to another application
    536
  26. How to save text from Clipboard to a file
    564
  27. How to show window contents while dragging
    449
  28. How to use TTF Font Without Installing
    1,112
  29. Window flashing
    378
  30. Does my CD-ROM drive contain an audio CD?
    361
  1. How to know whether the font is TrueTypeFont or not
    373
  2. How to track a user's idle time
    587
  3. How to remove your application from TaskBar
    655
  4. How to play sounds on the PC Speaker ?
    523
  5. How to install an INF file using Delphi ?
    460
  6. How to determine the output of a console application ?
    449
  7. Get text from the control at pos x,y on screen
    464
  8. Get dimensions of usable space on monitor (work area)
    486
  9. Get system info (free memory, etc)
    402
  10. How to Get Filenames from Clipboard ?
    1,500
  11. How to Get Windows OS Version ?
    424
  12. Get Windows Temp directory
    652
  13. Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL
    1,819
  14. Display Standard Windows Properties dialog
    1,125
  15. Disable Mouse and Keyboard from Delphi Code
    787
  16. Detecting and preventing Windows shut down
    432
  17. Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)
    411
  18. Controling sound volume from code
    417
  19. How to Close Another Application by Windows Caption
    384
  20. How to Change the Windows Start button bitmap
    421
  21. How to capture the output from a DOS (command/console) Window
    960
  22. How to Activate/Deactivate the Screen Saver
    855
  23. Retrieving all image links from an HTML document
    416
  24. List All Network Drives
    389
  25. How to set the "home page" for the Internet Explorer from Delphi code
    428
  26. How to get get IE favorites
    448
  27. Extracting the domain (host) name from an e-mail address
    482
  28. Download a file from the Internet with progress indicator
    551
  29. Are we connected to the Internet?
    419
  30. TImage.Bitmap fade out
    369
Recently updated
  1. Why SPF and DKIM Are Essential for Linux Email Servers?
    2
  2. How do I create animated background for Google Meet?
    19,014
  3. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    193
  4. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    75
  5. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    151
  6. Array of arguments passed to script in PHP
    83
  7. Invalid Auction Storms in Ad Tech
    91
  8. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    194
  9. The Two Clocks of Ad Server Architecture
    61
  10. Frequency Cap Architecture Overview
    505
  11. Collecting Proof-of-Play from 100,000 Screens
    139
  12. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    276
  13. What is RedisVL?
    102
  14. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    219
  15. TPU & GPU Cluster Management Tools
    229
  16. The Concept of Scaffolding in AI Agents
    217
  17. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    568
  18. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    246
  19. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    321
  20. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    196
  21. Machine Learning: Training vs. Ranking
    200
  22. The Continuous Learning Machine: Designing a Loop That Actually Turns
    212
  23. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    188
  24. Designing a Data Curation System Around a Vector Database
    212
  25. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    228
  26. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    646
  27. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    181
  28. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    203
  29. Understanding Data Lineage
    251
  30. System Requirements and Architecture: Intelligent Priority-Based Scheduler
    159