Hola champy.
Mira... voy a retocar un poco la función que hice a las apuradas ya que deja el archivo temporal en la tarjeta de memoria.
Y creo que a otros, tanto como a mí, podría no gustarles ese detalle...
Así que la nueva versión es:
Código Delphi
[-]
function MicroSDPresent: Boolean;
var
i : char;
FName: string;
Error: LongWord;
Hnd : THandle;
begin
Error := SetErrorMode(SEM_FAILCRITICALERRORS);
Result:= False;
for i := 'D' to 'Z' do
if GetDriveType(PChar(i+':\')) = DRIVE_REMOVABLE then
begin
FName:= Format('\\.\%s:\%s',[i,'@@@prueba@@@.txt']);
Hnd:= CreateFile(PChar(FName),
GENERIC_READ, 0, nil, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
if Hnd <> INVALID_HANDLE_VALUE then
begin
Result := True;
CloseHandle(Hnd);
DeleteFile(PChar(FName));
end;
end;
SetErrorMode(Error);
end;
Saludos.