AnsiString cUnidad = UpperCase(DriveComboBox1->Drive) + ":\\";
char cLabel[12];
unsigned long *nSerie;
memset(cLabel, '\0', 12);
GetVolumeInformation(cUnidad.c_str(), NULL, NULL, nSerie, NULL, NULL, NULL,
NULL);
pero al tratar de pasar nSerie a una variable tipo char (cLabel) mediante el
comando sprintf no logro el valor correcto que estoy viendo con el comando
VOL de MS-DOS. ¿Puede alguien sugerirme cómo obtener el resultado deseado?
--
Un saludo.
--------------------------------------
Ángel Matilla Candás - Toledo - España
ICQ: 14388338
*****************************************
http://www.internautas.org/
http://groups.icq.com/Internet/group.asp?no=1509237
AnsiString cUnidad = UpperCase(DriveComboBox1->Drive) + ":\\";
char cLabel[12];
unsigned long nSerie;
memset(cLabel, '\0', 12);
GetVolumeInformation(cUnidad.c_str(), NULL, NULL, &nSerie, NULL, NULL, NULL,
NULL);
Por si os vale, la rutina me ha quedado así:
unsigned long nSerie;
AnsiString cUnidad = UpperCase(DriveComboBox1->Drive) + ":\\";
AnsiString cLabel = "";
int nResto;
char cHexa[16][2] =
{"0\0","1\0","2\0","3\0","4\0","5\0","6\0","7\0","8\0","9\0","A\0","B\0","C\
0","D\0","E\0","F\0"};
GetVolumeInformation(cUnidad.c_str(), NULL, NULL, &nSerie, NULL, NULL, NULL,
NULL);
while (nSerie > 1)
{
nResto = nSerie % 16;
cLabel = AnsiString(cHexa[nResto]) + cLabel;
nSerie = INT(nSerie / 16);
}
Al terminar el bucle en cLabel está al valor que se obtendría con VOL.