Here is what I am using :
#include <qt_windows.h>
// Function to retrieve volume names
{
WCHAR szVolumeName[256] ;
WCHAR szFileSystemName[256];
DWORD dwSerialNumber = 0;
DWORD dwMaxFileNameLength=256;
DWORD dwFileSystemFlags=0;
bool ret = GetVolumeInformation( (WCHAR *) tdrive.utf16(),szVolumeName,256,&dwSerialNumber,&dwMaxFileNameLength,&dwFileSystemFlags,szFileSystemName,256);
vName.trimmed();
return vName;
}
// Get volume name of c drive
QString volume_name
= TvInfo
(tdrv
);
#include <qt_windows.h>
// Function to retrieve volume names
QString TvInfo(QString & tdrive)
{
WCHAR szVolumeName[256] ;
WCHAR szFileSystemName[256];
DWORD dwSerialNumber = 0;
DWORD dwMaxFileNameLength=256;
DWORD dwFileSystemFlags=0;
bool ret = GetVolumeInformation( (WCHAR *) tdrive.utf16(),szVolumeName,256,&dwSerialNumber,&dwMaxFileNameLength,&dwFileSystemFlags,szFileSystemName,256);
if(!ret)return QString("");
QString vName=QString::fromUtf16 ( (const ushort *) szVolumeName) ;
vName.trimmed();
return vName;
}
// Get volume name of c drive
QString tdrv="C:\\";
QString volume_name = TvInfo(tdrv);
To copy to clipboard, switch view to plain text mode
Hope this helps
Murielle
Bookmarks