Search results for 'GetDriveType'. 3 post(s) found.
- 2007/09/19 Detecting Drive Types
- 2007/09/10 Does my CD-ROM drive contain an audio CD?
- 2007/08/25 Get The Drive Type
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;
//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;
Another posts included in "Delphi"
| Disable Mouse and Keyboard from Delphi Code (0) | 2007/09/19 |
| Display Standard Windows Properties dialog (0) | 2007/09/19 |
| Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL (0) | 2007/09/19 |
| Detecting and preventing Windows shut down (0) | 2007/09/19 |
| Create new program group in the Start menu (0) | 2007/09/19 |
| Copying Group of Files using Delphi with Standard Animation Dialog (SHF... (0) | 2007/09/19 |
| Controling sound volume from code (0) | 2007/09/19 |
| How to Close Another Application by Windows Caption (0) | 2007/09/19 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 03:48
moneyideas
-
Subject different money making ideas
2010/01/29 12:47
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
We can use the Windows API function GetDriveType() to test if the drive is a CD-ROM drive then use the Windows API function GetVolumeInformation() to test if the VolumeName is 'Audio CD'.
function IsAudioCD(Drive : char) : bool;
var
DrivePath : string;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
VolumeName : string;
begin
Result := false;
DrivePath := Drive + ':\';
if GetDriveType(PChar(DrivePath))
<> DRIVE_CDROM then exit;
SetLength(VolumeName, 64) ;
GetVolumeInformation(PChar(DrivePath),
PChar(VolumeName),
Length(VolumeName),
nil,
MaximumComponentLength,
FileSystemFlags,
nil,
0) ;
if lStrCmp(PChar(VolumeName),'Audio CD') = 0
then result := true;
end;
var
DrivePath : string;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
VolumeName : string;
begin
Result := false;
DrivePath := Drive + ':\';
if GetDriveType(PChar(DrivePath))
<> DRIVE_CDROM then exit;
SetLength(VolumeName, 64) ;
GetVolumeInformation(PChar(DrivePath),
PChar(VolumeName),
Length(VolumeName),
nil,
MaximumComponentLength,
FileSystemFlags,
nil,
0) ;
if lStrCmp(PChar(VolumeName),'Audio CD') = 0
then result := true;
end;
Usage:
procedure TForm1.Button1Click(Sender: TObject) ;
begin
if not IsAudioCD('D') then
ShowMessage('Not an Audio CD in drive D') ;
end;
begin
if not IsAudioCD('D') then
ShowMessage('Not an Audio CD in drive D') ;
end;
Another posts included in "Delphi"
| Delete files with the ability to UNDO (0) | 2007/09/10 |
| Delete folders recursively (0) | 2007/09/10 |
| From/to the 8.3 (short) format to/from the long format (0) | 2007/09/10 |
| Convert a mapped drive to a full UNC path (0) | 2007/09/10 |
| Checking If File Is In Use (0) | 2007/09/10 |
| Browse for Computers, Folders, Files and Printers (0) | 2007/09/10 |
| How to draw Transparent Text on bitmap (0) | 2007/09/01 |
| How Do I Remove The Application Icon From The Taskbar? (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/25 08:37
moneyideas
-
Subject different money making ideas
2010/01/28 21:56
moneyideas
-
Subject different money making ideas
2010/01/29 06:22
moneyideas
-
Subject different money making ideas
2010/01/31 16:38
moneyideas
Shows how to identify the type of the drive you are acessing.
procedure TForm1.Button1Click(Sender: TObject);
var
typ:Integer;
s: string;
begin
s:='C:\';
typ:=GetDriveType(PChar(s));
if Typ <> 0 then case typ of
DRIVE_REMOVABLE:
begin
ShowMessage('Drive Removable / Diskette');
end;
DRIVE_FIXED:
begin
ShowMessage('Drive fixed / Festplatte');
end;
DRIVE_CDROM:
begin
ShowMessage('CD ROM Drive');
end;
DRIVE_RAMDISK:
begin
ShowMessage('RAM Drive');
end;
DRIVE_REMOTE:
begin
ShowMessage('Remote Drive / Netzlaufwerk');
end;
end;
end;
var
typ:Integer;
s: string;
begin
s:='C:\';
typ:=GetDriveType(PChar(s));
if Typ <> 0 then case typ of
DRIVE_REMOVABLE:
begin
ShowMessage('Drive Removable / Diskette');
end;
DRIVE_FIXED:
begin
ShowMessage('Drive fixed / Festplatte');
end;
DRIVE_CDROM:
begin
ShowMessage('CD ROM Drive');
end;
DRIVE_RAMDISK:
begin
ShowMessage('RAM Drive');
end;
DRIVE_REMOTE:
begin
ShowMessage('Remote Drive / Netzlaufwerk');
end;
end;
end;
Another posts included in "Delphi"
| How To Get Windows And System Directory (0) | 2007/08/25 |
| How To Get Volume Name (0) | 2007/08/25 |
| How To Register Own File Types (0) | 2007/08/25 |
| How can I modify aliases programmatically ? (0) | 2007/08/25 |
| Setting TQuery SQL Statement (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject Buy vicodin online next day delivery.
2008/12/14 11:14
Forum vicodin buy vicodin online. Buy vicodin online next day delivery. Buy vicodin online. Buy vicodin online without a prescription. Buy vicodin online without.
-
Subject Amoxicillin blood sugar.
2008/12/16 20:49
Amoxicillin clavulanate potassium. Amoxicillin. Amoxicillin for acne. Dosing of amoxicillin for sinus infection.
-
Subject Amoxicillin order mexico mexican.
2008/12/17 17:23
Amoxicillin dosage. Amoxicillin price. Amoxicillin. Amoxicillin side effects. Buy amoxicillin online cheap amoxicillin. Amoxicillin yeast infection. Amoxicillin allergy itch.
-
Subject Phentermine.
2008/12/17 18:05
Phentermine. Phentermine capsule. Phentermine side effects.
-
Subject Valium.
2009/01/23 21:34
Valium blue 10mg. Valium picture.
-
Subject Snorting adderall.
2009/01/25 00:31
Buy adderall without a prescription. Adderall. Adderall 7.5.
-
Subject What is clarinex-d.
2009/03/28 04:37
Clarinex. Is clarinex better.
-
Subject different money making ideas
2010/01/28 22:38
moneyideas
-
Subject different money making ideas
2010/01/29 06:50
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed