搜 索 计 算 机 中 所 有 驱 动 器
来源:互联网 发布:网络交换机报价 编辑:程序博客网 时间:2024/05/08 06:25
void FindDriverInfo()
{
CComboBox* Driver=(CComboBox*)GetDlgItem(IDC_DRIVER);
DWORD dwNumBytesForDriveStrings;
HANDLE hHeap;
LPSTR lp;
CString strLogdrive;
int nNumDrives=0, nDriveNum;
dwNumBytesForDriveStrings=GetLogicalDriveStrings(0,NULL)
*sizeof(TCHAR);//实际存储驱动器号的字符串长度
if (dwNumBytesForDriveStrings!=0) {
hHeap=GetProcessHeap();
lp=(LPSTR)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,
dwNumBytesForDriveStrings);//
GetLogicalDriveStrings(HeapSize(hHeap,0,lp),lp);
StringBox.SetSize(dwNumBytesForDriveStrings/sizeof(TCHAR)+1);
while (*lp!=0) {
if (GetDriveType(lp)==DRIVE_REMOVABLE){
Driver->AddString(lp);
StringBox[nNumDrives]=lp;
nNumDrives++;
}
lp=_tcschr(lp,0)+1;
}
}
else AfxMessageBox("Can't Use The Function GetLogicalDriveStrings!");
}
{
CComboBox* Driver=(CComboBox*)GetDlgItem(IDC_DRIVER);
DWORD dwNumBytesForDriveStrings;
HANDLE hHeap;
LPSTR lp;
CString strLogdrive;
int nNumDrives=0, nDriveNum;
dwNumBytesForDriveStrings=GetLogicalDriveStrings(0,NULL)
*sizeof(TCHAR);//实际存储驱动器号的字符串长度
if (dwNumBytesForDriveStrings!=0) {
hHeap=GetProcessHeap();
lp=(LPSTR)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,
dwNumBytesForDriveStrings);//
GetLogicalDriveStrings(HeapSize(hHeap,0,lp),lp);
StringBox.SetSize(dwNumBytesForDriveStrings/sizeof(TCHAR)+1);
while (*lp!=0) {
if (GetDriveType(lp)==DRIVE_REMOVABLE){
Driver->AddString(lp);
StringBox[nNumDrives]=lp;
nNumDrives++;
}
lp=_tcschr(lp,0)+1;
}
}
else AfxMessageBox("Can't Use The Function GetLogicalDriveStrings!");
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=271241
- 搜 索 计 算 机 中 所 有 驱 动 器
- 搜 索 计 算 机 中 所 有 驱 动 器
- 计 算 器
- java检测所给数组中是否有重复元素
- 爱不为情所动!
- JAVA的 计机二级 那个网站有<南开一百题>买
- 硬盘容量计算法,现在有问题啦!!
- 分页管理系统计算题 (在某个请求分页管理系统中,假设某进程的页表内容如下表所示)
- C#中有virtual关键字而Java中没有所带来的思考
- 计 算 机 图 形 学 常用 词 汇 表
- 逆势而动,也有生命力
- 为情所动时,不要有所行动
- 人为幸福所动——无法承受之重
- 数据有选择性的导入到所需要的表中
- Tab 实现知多少,?你所知道有多少 你都知道吗( 持续更新中。。。。。。)?
- 关于SQLServer建表过程中所报的类似"xx 附近有语法错误"
- 软件实施整个流程中所涉及的文档有哪些?
- JS中定义的function所传整型参数最大能有多大?
- GRUB 配置大全-syd168
- 网络机器人(Spli),网络蜘蛛(crawlers) 开源项目收集
- 关于获取本地磁盘盘符
- Spanning-Tree Feature configure
- 自Servlet存取seam组件
- 搜 索 计 算 机 中 所 有 驱 动 器
- Ui 设计(引用)
- 日语ている与てある的用法区别
- 论C/C++函数间动态内存的传递(转载)
- 图片连续不断的滚动的特效
- ERP管理软件中“集成”的七个管理思想[转]
- HWND、THANDLE、 HDC 的区别
- 《ASP入门-微软版》笔记
- FlexGrid中添加Windows控件