Autor Beitrag
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 01.02.03 13:33 
Hi Leuts, :wave:
Weiß jemand wie man die Geschwindigkeit eines CD-Laufwerks rausbekommt. Steht das in der Regsitry oder muss man das Laufwerk irgendwie testen? :nixweiss:

Ich dachte an eine Funktion die mir zum Beispiel zurückgibt:
"Laufwerk E: 52-fach".

Hat jemand ´ne Idee oder weiß es jemand?

Danke schon im Voraus!

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Sa 01.02.03 15:37 
also in der registry wird es nicht stehen.
Du musst die Firmware des laufwerks auslesen. Da findest du die info.
Die tatsächliche geschwindigkeit muss man aber schon selber messen.
Habe aber keine Ahnung, wie man das genau anstellen sollte.

Gruß
Ken
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Sa 01.02.03 16:27 
Also, zum messen habe ich mir mal was einfallen lassen:
ausblenden 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:
const
 File1 = 'E:\Autorun.inf';
 Files: Array[0..4] Of String = ('E:\Data.csv', 'E:\Opera32.exe', 'E:\Intro.exe', 'E:\Oprjs32.dll', 'E:\OpTree32.dll');
var
 S: TMemoryStream;
 A, B, F, FileSize: Int64;
 I: Integer;
 Speed: Double;
begin
 S := TMemoryStream.Create;
 S.LoadFromFile(File1); // 1. Datei lesen (für Spin-Up)
 FileSize := 0;

 SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL); // Höchste Priorität
 QueryPerformanceCounter(A);                                         // Zeit speichern
 For I := Low(Files) To High(Files) Do begin
  S.LoadFromFile(Files[I]);                                          // Dateien lesen
  FileSize := FileSize + S.Size;                                     // Größe speichern
 end;
 QueryPerformanceCounter(B);                                          // Zeit speichern
 SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_Normal);         // Priorität zurücksetzen

 QueryPerformanceFrequency(F);
 Speed := (FileSize / (150 * 1024)) / ((B - A) / F); // speed = 150kB / Sekunden (150kB/s = 1-fach)
 ShowMessageFmt('%.3fMB in %.3fs'#13#10'%.0f-fach', [FileSize / (1024 * 1024), (B - A) / F, Speed]);
 S.Free;


Die Probleme:
- Du müsstest vor dem lesen den Lese-Puffer des aufwerks leeren, ich weiß aber nicht, wie man das macht
- Die Angaben stimmen sowieso nicht. Aber du kannst ja mal probieren, ob du die Prozedur so modifizieren kannst, dass es stimmt.
- Wenn ein Laufwerk 30x heißt, dann liest es in der Praxis normalerweise nicht mit der vollen Geschwindigkeit. Das bedeutet, mit Messen kommst du theoretisch nie auf das exakte Ergebnis.
GSE Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 01.02.03 18:54 
Danke erstmal,

werd mir den Code mal ansehen!

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)