-
October 30th, 2007, 03:44 AM
#1
CFile::GetStatus takes too much time to check not exist file
hi,
I used "static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );" to get file status information in my code, but if the lpszFileName was a network file path(such as "\\192.168.0.125\test\test.txt"), and the "test.txt" file did not exist, it would take a lot of time to wait CFile::GetStatus return.
Can anything do to cut down the waitng time? Cos my application got lots files to check, and it really take too much time to wait.
Thanks.
c chen
-
October 30th, 2007, 04:21 PM
#2
Re: CFile::GetStatus takes too much time to check not exist file
Hello,
don't know if following works or is even faster.
Code:
SHFILEINFO shFileInfo;
if (0 != ::SHGetFileInfo(lpszFileName, 0, &shFileInfo, sizeof(SHFILEINFO), SHGFI_TYPENAME)) ...
-
October 30th, 2007, 05:12 PM
#3
Re: CFile::GetStatus takes too much time to check not exist file
Originally Posted by c.chen
Can anything do to cut down the waitng time?
That CFile::GetStatus() function does a LOT of things.
If you only need to check existence - try _taccess() with the mode 0.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
October 30th, 2007, 09:21 PM
#4
Re: CFile::GetStatus takes too much time to check not exist file
Thanks you two, i tried SHGetFileInfo and _taccess,SHGetFileInfo took about 80s and _taccess just the same as CFile::GetStatus, it took about 27s.
Any other ideas? I found that CMD tool PING can detect the host's existence quickly. Some way to use that technology?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|