鱼C论坛

 找回密码
 立即注册
查看: 3240|回复: 0

求助: 一个文件管理器的初始化逻辑分区,获取参数目录是怎么弄的。

[复制链接]
发表于 2012-11-18 15:22:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
//////////////////////////////////////////////////////////////////////////
//函数名称:InitPath
//函数介绍:初始化逻辑分区,仅关心硬盘分区
//输入参数:无
//输出参数:无
//返回值:  无
//////////////////////////////////////////////////////////////////////////
void CFileAssistantDlg::InitPath(void)
{
wchar_t *pLogicalDrives = new wchar_t[MAX_PATH];
pLogicalDrives[0] = '\0';
int nLen = GetLogicalDriveStrings(MAX_PATH-1,pLogicalDrives);
if (0 == nLen)
{
  return;
}
int nDriverNameLength = wcslen(L"C:\\")+1; 这里为什么要加一。  
int i = 0;
TVINSERTSTRUCT tvInsertItem;
tvInsertItem.hParent = NULL;
tvInsertItem.hInsertAfter = NULL;
tvInsertItem.item.mask = TVIF_TEXT;
do
{
  tvInsertItem.item.pszText = pLogicalDrives+i;
  m_tcDirectories.InsertItem(&tvInsertItem);
  i += nDriverNameLength;
} while (i<nLen);
delete[] pLogicalDrives;//回收缓冲区
}

代码: FileAssistant.rar (34.66 KB, 下载次数: 0)
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-16 08:58

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表