FFIND(ff.GetFilePath()+"//*.*");
}
else if(!ff.IsDirectory() && !ff.IsDots())
{
//是文件则,写数据库 File Info
CFileStatus rStatus;//File Info structure Type
if(CFile::GetStatus(ff.GetFilePath(),rStatus)){
CString strSql;// access Data Base operate
CString FileName = ff.GetFileName();
FileName.Replace("'","''");
CString FilePath = ff.GetFilePath();
FilePath.Replace("'","''");
strSql.Format("insert into File([filename],[path],[filesize],[modified],[lastaccess],[create]) values('%s','%s','%d','%d','%d','%d')"
,FileName,FilePath,rStatus.m_size,rStatus.m_mtime
,rStatus.m_atime,rStatus.m_ctime);
//Execute
try{
//Thread Error Link Error ;
m_pConnection->Execute((LPCTSTR)strSql,&vFieldName,adCmdText);
}catch(_com_error e)
{
AfxMessageBox(e.Description());
long errorCode=e.WCode();
if(3127==errorCode) AfxMessageBox("表不存在");
if(3092==errorCode) AfxMessageBox("表已经存在");
return;
}
}
}//else if
}
ff.Close();
}
搜索C盘所有 文件数= 49178 目录= 4359 大概6.77 GB大小的盘 居然花费拉8分钟
CPU还是高高在上怎么样能把CPU让出来效率上有很大的提高那?
/////////////////////////
/*MSG msg;
if(::GetMessage(&msg,NULL,0,0)){
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}*/
//////////////////////////
这段加到里面CPU是下来拉 但是是出奇的慢.
<---->
呵呵,楼主的代码经典,收藏.
<---->
{ //线程 启动去扫描.我没用线程的时候cpu 100%
CMFCADODlg *pDlg=(CMFCADODlg*)lparam;
pDlg->FFIND("c://*.*");
AfxMessageBox("扫描完成");
}
线程函数没有return,居然能运行~_~
<---->
<---->
<---->
<---->
楼主,在主里这个事件好像没有用到,你把它注释了看一看.呵呵,我也是猜想,不知道对不对
<---->
HANDLE m_hEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
//WaitForSingleObject(m_hEvent,1);
注释下去拉没贴上来感觉也没什么用.怎么搞那这个东西有点越来越有兴趣研究拉.
<---->
//WaitForSingleObject(m_hEvent,1);
cpu 下来拉但是速度更慢拉.
因该对数据库找找原应吧.怎样搞?
<---->
<---->
<---->
想到文本在写库?有好资料瞧瞧.我先瞧瞧去.
<---->
<---->
<----><---->
<---->