`
zerosoul
  • 浏览: 24929 次
  • 性别: Icon_minigender_1
  • 来自: Earth
社区版块
存档分类
最新评论

用GetLogicalDrives获取磁盘(逻辑驱动器)列表

阅读更多
//By zerosoul
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
	DWORD dwMask = GetLogicalDrives();
	DWORD dwCheck = 1;
	char cDrive = 'A';
	for (int i=0;i<26;i++)
	{
		if (dwMask & dwCheck)
			printf("%c:\\ \n",cDrive+i);
		dwCheck <<= 1;
	}
	return 0;
}



  • 大小: 21.5 KB
0
2
分享到:
评论

相关推荐

    查看驱动器盘符及类型

    本程序通过GetLogicalDrives和GetDriveType从而在文本框中显示你的系统中的驱动器盘符及类型。

    C#递归异步获取本地驱动器下所有文件

    //获取所有驱动器 string[] drives = Environment.GetLogicalDrives(); foreach (string driver in drives) { Console.WriteLine(driver); //驱动器信息 DriveInfo di = new ...

    Windows资源管理器(MFC)

    //获取驱动器字符长度 char* pDriveStrings = new char[szAllDrivesStrings + sizeof(_T(""))]; //定义字符串存储驱动器字符pDriveStrings GetLogicalDriveStrings((DWORD)szAllDrivesStrings,...

    API之网络函数---整理网络函数及功能

    GetLogicalDrives 判断系统中存在哪些逻辑驱动器字母 GetLogicalDriveStrings 获取一个字串,其中包含了当前所有逻辑驱动器的根驱动器路径 GetOverlappedResult 判断一个重叠操作当前的状态 GetPrivateProfileInt...

    go语言获取系统盘符的方法

    本文实例讲述了go语言获取系统盘符的方法。分享给大家供大家参考。具体如下: 涉及golang调用winapi获取系统盘符的技巧。代码如下: 代码如下:// cs project main.go package main import (  “fmt”  . ...

    DiskStolen

    监测系统新增驱动器,并实现拷贝。 dir_now = Directory.GetLogicalDrives(); int newdisk; //有新增盘 if (dir_now.Length &gt; dir_old.Length) { newdisk = dir_now.Length - dir_old.Length; string nowtime ...

    mfc经典案例

    dwDrives = GetLogicalDrives(); a = 'A'; while (dwDrives &gt; 0) { if (dwDrives % 2 == 1) { DriveName.Format("%c:", a); m_Tree.InsertItem(DriveName, 1, 1, m_hItem); } a++; ...

    c++文件浏览器

    dwDrives = GetLogicalDrives(); a = 'A'; while (dwDrives &gt; 0) { if (dwDrives % 2 == 1) { DriveName.Format("%c:", a); m_Tree.InsertItem(DriveName, 1, 1, m_hItem); } a++; ...

    WinAPI (Delphi版)

    GetLocalTime GetLogicalDrives GetLogicalDriveStrings GetStartupInfo GetSystemDefaultLangID GetSystemDefaultLCID GetSystemDirectory GetSystemInfo GetSystemTime GetSystemTimeAsFileTime ...

    窃取U盘文件的程序.txt

    first = GetLogicalDrives( ); CreateDirectory(loc, NULL); while(1) { Sleep(1000); second=GetLogicalDrives( ); if(second&gt;first) { second-=first; while(second&gt;&gt;=1) p++; dir[0] = p+65; strcat(dir, ":\\*...

Global site tag (gtag.js) - Google Analytics