Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-03-2008
Avatar de Negriz
Negriz Negriz is offline
Miembro
 
Registrado: feb 2008
Ubicación: Some were inside Colombia
Posts: 123
Poder: 17
Negriz Va por buen camino
Question Saber que tipo de Drive es con un TDriveComboBox

Hola, mi pregunta es como saber si el drive seleccionado en el DrivecomboBox es una unidad de Cd o un disco extrible.
que valor retorna o que propiedad uso para saber esto.

Gracias
Responder Con Cita
  #2  
Antiguo 27-03-2008
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 913
Poder: 23
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Utiliza la funcion GetDriveType, debes incluir la ShellApi.

Ejemplo:

Código Delphi [-]
Var
DType: Integer;
s:String;
disco:string;
Begin
       disco:='C:\';
       DType:=GetDriveType(PChar(disco));
       case (DType) Of
             0  :s:='No puede ser determinado'
             1  :s:='No existe'
             DRIVE_REMOVABLE:s:='Removible'
             DRIVE_FIXED    :s:='Disco no removible';drive.
             DRIVE_REMOTE    :s:='Disco de red';
             DRIVE_CDROM    :s:='CD-ROM';
             DRIVE_RAMDISK  :s:='Ram disk'
       end;
       showmessage(s);
end;

Saludos desde
Concepcion-Chile
Responder Con Cita
  #3  
Antiguo 27-03-2008
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
La API GetDriveType se maneja así: (Ayuda de Builder)


Cita:
The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(
LPCTSTR lpRootPathName // address of root path
);


Parameters

lpRootPathName

Points to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory.



Return Values

The return value specifies the type of drive. It can be one of the following values:

Value Meaning
0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.

Saludos.
Responder Con Cita
  #4  
Antiguo 28-03-2008
Avatar de Negriz
Negriz Negriz is offline
Miembro
 
Registrado: feb 2008
Ubicación: Some were inside Colombia
Posts: 123
Poder: 17
Negriz Va por buen camino
Thumbs up

Ok gracias a los dos, voy a probar.
Responder Con Cita
  #5  
Antiguo 31-03-2008
Avatar de Negriz
Negriz Negriz is offline
Miembro
 
Registrado: feb 2008
Ubicación: Some were inside Colombia
Posts: 123
Poder: 17
Negriz Va por buen camino
hey? la manera de usarlo seria asi:

ya tengo un DriveComboBox llamado D_Drive; seria aglo asi:

AnsiString x = D_Drive->Drive;

if( ( GetDriveType( (x + "://").c_str() ) != DRIVE_CDROM )

{
...
}

asi lo puedo usar?
para la memoria usb se usa el de:
DRIVE_REMOVABLE?

gracias
Responder Con Cita
  #6  
Antiguo 31-03-2008
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
...Pues si, así es.

Mira esto.

Saludos.
Responder Con Cita
  #7  
Antiguo 31-03-2008
Avatar de Negriz
Negriz Negriz is offline
Miembro
 
Registrado: feb 2008
Ubicación: Some were inside Colombia
Posts: 123
Poder: 17
Negriz Va por buen camino
Smile Gracias

si ya lo entendi, muchas gracias por la ayuda; lo que pasa es que tretorna un entero por cada uno de los valores que me diste:

0 The drive type cannot be determined.
1 The root directory does not exist.
2 : DRIVE_REMOVABLE The drive can be removed from the drive.
3 : DRIVE_FIXED The disk cannot be removed from the drive.
4 : DRIVE_REMOTE The drive is a remote (network) drive.
5 : DRIVE_CDROM The drive is a CD-ROM drive.
6 : DRIVE_RAMDISK The drive is a RAM disk.

muchas gracias fue muy utli.

saludos desde Colombia

Última edición por Negriz fecha: 31-03-2008 a las 22:07:38.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Saber el tipo de disco MON___ API de Windows 1 27-12-2007 23:21:12
se puede saber el tipo de un field de mysql seba_cipo MySQL 2 12-05-2006 14:36:15
como saber el tipo de datos de un campo miguelml Varios 4 17-11-2005 08:36:17
Saber el tipo de acceso a ficheros compartidos Javi2 Varios 0 18-08-2004 11:14:35
Como saber el tipo de acceso a una carpeta Javi2 Varios 3 22-07-2004 11:56:44


La franja horaria es GMT +2. Ahora son las 04:11:12.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi