05-06-2002 01:30 AM
05-06-2002 03:58 AM
06-14-2010 04:26 AM - edited 06-14-2010 04:27 AM
Old question, but still relevant.
I have the same question, but have not found the solution. E.g. when connecting an USB memory stick it will appear with a name, often when new, brand name of the USB memory. I want to look for a specific name.
I can’t find this with GetDir()
Regards,
Gerhard
06-14-2010 04:58 AM
06-14-2010 06:09 AM
Yes !
Thanks, it worked !
Gerhard
Code:
______________________________________________________________________
int CVICALLBACK FindUSB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int Loop, Result, CurrentDrv, NumberOfDrv;
char DirName[MAX_PATHNAME_LEN];
char lpVolumeNameBuffer[MAX_PATHNAME_LEN];
char lpVolumeSerialNumber[MAX_PATHNAME_LEN];
char lpFileSystemNameBuffer[MAX_PATHNAME_LEN];
switch (event)
{
case EVENT_COMMIT:
for (Loop = 0; Loop <= 25; Loop++)
{
Result = SetDrive (Loop);
printf("SetDrive %2d / %c: %d", Loop, (char) (Loop + 65), Result);
if (!Result)
{
Result = GetDrive (&CurrentDrv, &NumberOfDrv);
printf(" GetDrive %c: %d %d", (char) (CurrentDrv + 65), NumberOfDrv, Result);
Result = GetDir (DirName);
if (!Result)
{
printf(" Dir: %s", DirName);
GetVolumeInformation( NULL, // lpRootPathName,
lpVolumeNameBuffer, // lpVolumeNameBuffer,
300, // nVolumeNameSize,
NULL, // lpVolumeSerialNumber,
NULL, // lpMaximumComponentLength
NULL, // lpFileSystemFlags,
lpFileSystemNameBuffer, // lpFileSystemNameBuffer,
300); // nFileSystemNameSize)
printf(" VolumeName: %s", lpVolumeNameBuffer);
}
}
printf("\n");
}
break;
}
return 0;
}