zoukankan      html  css  js  c++  java
  • C语言_find族函数的使用,如何实现Windows文件加载

    windows目录查看器

    // 转到按钮处理函数
    #include <io.h>
    
    void CFindFileDlg::OnBnClickedOk()
    {
    	struct _wfinddata64_t c_file;
    	intptr_t hFile;
    	CListCtrl *pList = (CListCtrl *)GetDlgItem(IDC_FILE_LIST);
    	CString path;
    	CString str_time, str_type, str_size;
    	GetDlgItemText(IDC_BROWER, path);
    	path.Append(_T("*.*"));
    	if ((hFile = _wfindfirst64(path, &c_file)) == -1L)
    		return;
    	int i = 0;
    	int n;
    	pList->DeleteAllItems();
    	do 
    	{
    		n = pList->GetItemCount();
    		if (!(c_file.attrib & _A_HIDDEN)) // 显示非隐藏文件
    			pList->InsertItem(i, c_file.name);
    		COleDateTime t(c_file.time_write);
    		str_time.Format(_T("%d/%d/%d %d:%d"), t.GetYear(), t.GetMonth(), 
                                    t.GetDay(), t.GetHour(), t.GetMinute());
    		pList->SetItemText(n, 1, str_time);
    		
    		if (c_file.attrib & _A_SUBDIR)
    			pList->SetItemText(n, 2, _T("文件夹"));
    		else
    		{
    			CString name = c_file.name;
    			str_type = name.Mid(1 + name.ReverseFind(_T('.')));
    			pList->SetItemText(n, 2, str_type+_T("文件"));
    
    			str_size.Format(_T("%d"), c_file.size / 1024);
    			str_size.Append(_T("KB"));
    			pList->SetItemText(n, 3, str_size);
    		}
    		++i;
    	} while (_wfindnext64(hFile, &c_file) == 0);
    	_findclose(hFile);
    }
    

    效果实现

    加载失败

  • 相关阅读:
    设置cookie,读取cookie案例
    npm常用命令及版本号浅析
    nrm安装与使用
    ES6解构赋值
    nodemon 基本配置与使用
    nodejs开发辅助工具nodemon
    Node自动重启工具 nodemon
    深入浅出Object.defineProperty()
    js原生缓慢返回顶部函数封装
    The linux command 之权限
  • 原文地址:https://www.cnblogs.com/veis/p/12724176.html
Copyright © 2011-2022 走看看