...check, if a CD-Recorder is available? (WinXP)
Author: Dev4u.ch
{....}
uses Registry;
{....}
function HasCDRecorder: Boolean;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
try
// set the the Mainkey, bestimmt den Hauptschlüssel
reg.RootKey := HKEY_CURRENT_USER;
// Open a key, den Schlüssel öffnen
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning', False);
// Check if the Key exists, Überprüfen ob die Zeichenfolge existiert
Result := reg.ValueExists('CD Recorder Drive');
// Close the key, Schlüssel schliessen
reg.CloseKey;
finally
// and free the TRegistry Object, das TRegistry Objekt freigeben
reg.Free;
end;
end;
// Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
if HasCDRecorder then
ShowMessage('CD-Recorder available.')
else
ShowMessage('CD-Recorder NOT available.');
end;
printed from
www.swissdelphicenter.ch
developers knowledge base