Autor Beitrag
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Do 29.04.04 07:13 
Hey Leut's...

Weis jemand wie ich die Meldung (Keine Diskette eingelegt, oder so) überbrücken kann???

Ich suche nach allen Laufwerken und deren Typ, bekomme aber bei Wechseldatenträgern immer Fehlermeldungen die der Benutzer ja nicht sehen brauch...

Wie kriege ich die nun weg :?:

Schon vielen Dank im vorraus...


MFG Stefan
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 29.04.04 07:51 
Setz vor der Abfrage SetErrorMode auf SEM_FAILCRITICALERRORS und danach wieder zurück auf 0.

Edit: Unter 2000 funktioniert dieser Code auch ohne Fehlermeldung, wenn kein Datenträger eingelegt ist:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
function DriveExists(DriveByte: Byte): Boolean;
begin
  Result := GetLogicalDrives and (1 shl DriveByte) <> 0;
end;

function GetDriveTypeString(Drive: Byte): String;
begin
  case GetDriveType(PChar(Chr(Drive + Ord('A')) + ':\'))  of
    DRIVE_UNKNOWN: result := 'The drive type cannot be determined.';
    DRIVE_NO_ROOT_DIR: result := 'The root path is invalid. For example, no volume is mounted at the path.';
    DRIVE_REMOVABLE: result := 'The disk can be removed from the drive.';
    DRIVE_FIXED: result := 'The disk cannot be removed from the drive.';
    DRIVE_REMOTE: result := 'The drive is a remote (network) drive.';
    DRIVE_CDROM: result := 'The drive is a CD-ROM drive.';
    DRIVE_RAMDISK: result := 'The drive is a RAM disk.';
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Cardinal;
  s: String;
begin
  for i := 0 to 25 do
  begin
    if DriveExists(i) then
    begin
      s := GetDriveTypeString(i);
      Listbox1.Items.Add(chr(i+ord('A'))+': ['+s+']');
    end;
  end;
end;
Stefan-W Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Do 29.04.04 12:42 
Danke für die Antwort!!!! :D

Aber das hätte gelangt...

Luckie hat folgendes geschrieben:
Setz vor der Abfrage SetErrorMode auf SEM_FAILCRITICALERRORS und danach wieder zurück auf 0.


Werd ich gleich mal testen!!!

Noch ein Schönen Tag!!!

MFG Stefan