<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Want to get drive detail with GetVolumeInformation.]]></title><description><![CDATA[<p dir="auto">Want to get drive detail list of drives, total size, used space, free space ,drive is external ,hard disk.</p>
<p dir="auto">@<br />
QString TvInfo(QString &amp; tdrive)<br />
{</p>
<pre><code>WCHAR szVolumeName[256] ;
WCHAR szFileSystemName[256];
DWORD dwSerialNumber = 0;
DWORD dwMaxFileNameLength=256;
DWORD dwFileSystemFlags=0;

bool ret = false;
qDebug()&lt;&lt;  "get bool return-----" &lt;&lt;GetVolumeInformation( (WCHAR *) tdrive.utf16(),szVolumeName,256,&amp;dwSerialNumber,&amp;dwMaxFileNameLength,&amp;dwFileSystemFlags,szFileSystemName,256);
qDebug()&lt;&lt; "FileSystemName format type----"&lt;&lt;QString::fromUtf16 ( (const ushort *) szFileSystemName) ;
qDebug()&lt;&lt; "VolumeName--------v"&lt;&lt;QString::fromUtf16 ( (const ushort *) szVolumeName).toAscii();
qDebug()&lt;&lt; "SerialNumber"&lt;&lt;dwSerialNumber ;
qDebug()&lt;&lt; "MaxFileNameLength"&lt;&lt;dwMaxFileNameLength ;

qDebug()&lt;&lt; "FileSystemFlags"&lt;&lt; dwFileSystemFlags;
</code></pre>
<p dir="auto">qDebug()&lt;&lt; "hello "&lt;&lt; 256 ;<br />
if(!ret)return QString("");<br />
QString vName=QString::fromUtf16 ( (const ushort *) szVolumeName) ;<br />
vName.trimmed();<br />
return vName;<br />
}</p>
<p dir="auto">void Drive::GetDriveDetail()<br />
{<br />
qDebug()&lt;&lt;"all get drive here////////////////////////////////////////////////////";<br />
foreach( QFileInfo drive, QDir::drives() )<br />
{<br />
qDebug()&lt;&lt;"--------------------------------";<br />
QString tdrv=drive.absolutePath();<br />
bool tdrvisdirectory=drive.isDir();<br />
qDebug()&lt;&lt;"tdrvisdirectory---------"&lt;&lt;tdrvisdirectory;<br />
qDebug()&lt;&lt;"path----"&lt;&lt;tdrv ;<br />
QString volume_name = TvInfo(tdrv);<br />
qDebug()&lt;&lt;"volume name--------"&lt;&lt;volume_name;<br />
}<br />
}@</p>
<h2>my output is.<br />
@<br />
all get drive here////////////////////////////////////////////////////</h2>
<h2>tdrvisdirectory--------- true<br />
path---- "C:/"<br />
get bool return----- 1<br />
FileSystemName format type---- "NTFS"<br />
VolumeName--------v ""<br />
SerialNumber 2551737821<br />
MaxFileNameLength 255<br />
FileSystemFlags 65470719<br />
hello  256<br />
volume name-------- ""</h2>
<p dir="auto">tdrvisdirectory--------- true<br />
path---- "F:/"<br />
get bool return----- 1<br />
FileSystemName format type---- "NTFS"<br />
VolumeName--------v "New Volume"<br />
SerialNumber 208470474<br />
MaxFileNameLength 255<br />
FileSystemFlags 65470719<br />
hello  256<br />
volume name-------- ""<br />
@</p>
<p dir="auto">here i want list of drives, total size, used space, free space ,drive is external ,hard disk.but some thing are missing</p>
]]></description><link>https://forum.qt.io/topic/19354/want-to-get-drive-detail-with-getvolumeinformation</link><generator>RSS for Node</generator><lastBuildDate>Wed, 06 May 2026 07:09:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/19354.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Aug 2012 06:43:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Want to get drive detail with GetVolumeInformation. on Sat, 25 Aug 2012 15:24:42 GMT]]></title><description><![CDATA[<p dir="auto">Hello.<br />
I suggest you not to follow MS's ideology NIH and use Qt and Boost for your purposes:</p>
<h1>Get drive list with "QFSFileEngine::drives ()":<a href="http://doc.qt.nokia.com/4.7-snapshot/qfsfileengine.html#drives" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7-snapshot/qfsfileengine.html#drives</a>.</h1>
<h1>Use Bost.FileSystem function "space":<a href="http://www.boost.org/doc/libs/1_51_0/libs/filesystem/doc/reference.html#space" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.boost.org/doc/libs/1_51_0/libs/filesystem/doc/reference.html#space</a> to get information about drives.</h1>
<p dir="auto">You may need a convertion from QString to std::basic_string&lt;wchar_t&gt; for Windows or std::basic_string&lt;char&gt; for other OS.</p>
]]></description><link>https://forum.qt.io/post/148542</link><guid isPermaLink="true">https://forum.qt.io/post/148542</guid><dc:creator><![CDATA[Wilk]]></dc:creator><pubDate>Sat, 25 Aug 2012 15:24:42 GMT</pubDate></item></channel></rss>