如何在vc ++中获取窗口系统的驱动器名称 [英] how to get drives name of window system in vc++
本文介绍了如何在vc ++中获取窗口系统的驱动器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过执行程序来了解系统中有多少个驱动器.
有人可以通过rahul.prakash257@gmail.com答复我吗?
I want to know how many drives in a system exists by executing programs.
can anybody reply me at rahul.prakash257@gmail.com
推荐答案
参见下面的代码.它列出了所有驱动器,包括映射的驱动器
see below code. It lists all drives including mapped drives
DWORD dwLogicalDrives = GetLogicalDrives() << 1;
int nIdx = 1;
char chDrive = 'A';
CString csDrive;
while( dwLogicalDrives )
{
if(dwLogicalDrives & static_cast<int>( pow( 2, nIdx )))
{
csDrive = chDrive;
AfxMessageBox( csDrive );
}
++nIdx;
++chDrive;
}</int>
使用也可以使用WMI.有关WMI的更多信息,请在Google上搜索:)
Use can also use WMI for it. For more information on WMI, google it :)
这篇关于如何在vc ++中获取窗口系统的驱动器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文