A função GetWindowsDrive mostrada abaixo retorna a letra correspondente à unidade de armazenamento (drive/disco) onde o Windows está instalado.
Inclua na seção uses: Windows, Dialogs
function GetWindowsDrive: Char; var Buffer: string; begin SetLength(Buffer, MAX_PATH); if GetWindowsDirectory(PChar(Buffer), MAX_PATH) > 0 then Result := string(Buffer)[1] else Result := #0; end;
Exemplo de uso
procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage('O Windows está instalado na unidade ' + GetWindowsDrive); end;
O conteúdo desta página pode ajudar alguém? Compartilhe!