OBTENIENDO LA LETRA DE LA UNIDAD DE CD-ROM
Publicado por Jose Miguel (18 intervenciones) el 13/09/2001 00:40:46
Hola. Me gustaria obtener la letra de la unidad de cdrom, yo uso el Delphi 3.0. A mi me dejaron una funcion pero no me funciona, me da error al compilar, en el longword. La funcion es esta:
function GetFirstCdRomDrive: string;
var
r: LongWord;
Unidades: array[0..128] of char;
pUnidad: pchar;
begin
Result := '';
r := GetLogicalDriveStrings(sizeof(Unidades), Unidades);
if r = 0 then exit;
if r > sizeof(Unidades) then
raise Exception.Create(SysErrorMessage(ERROR_OUTOFMEMORY));
pUnidad := Unidades; // Apunta a la primera unidad
while pUnidad^ <> #0 do begin
if GetDriveType(pUnidad) = DRIVE_CDROM then begin
Result := pUnidad;
exit;
end;
inc(pUnidad, 4); // Apunta a la siguiente unidad
end;
end;
Tambien me gustaria saber como tendrian que declarar la función. Muchas gracias por todo,
function GetFirstCdRomDrive: string;
var
r: LongWord;
Unidades: array[0..128] of char;
pUnidad: pchar;
begin
Result := '';
r := GetLogicalDriveStrings(sizeof(Unidades), Unidades);
if r = 0 then exit;
if r > sizeof(Unidades) then
raise Exception.Create(SysErrorMessage(ERROR_OUTOFMEMORY));
pUnidad := Unidades; // Apunta a la primera unidad
while pUnidad^ <> #0 do begin
if GetDriveType(pUnidad) = DRIVE_CDROM then begin
Result := pUnidad;
exit;
end;
inc(pUnidad, 4); // Apunta a la siguiente unidad
end;
end;
Tambien me gustaria saber como tendrian que declarar la función. Muchas gracias por todo,
Valora esta pregunta
0