Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WHAT HAPPENED to WinAPI Function FtpFindFirstFile()?

WHAT HAPPENED to WinAPI Function FtpFindFirstFile()?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++algorithmsquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chaos Lawful
    wrote on last edited by
    #1

    I'm writing a multi-threaded FTP sites and contents searching program using WININET lib. When I search the contents in a FTP site, I have to enumerate the files under a directory. But when I use MFC's CFtpFileFind class, it terminated with a error message at FtpFindFirstFile() when there're some thousands of files under the directory. I tried many times but it still failed. I can't solve this problem. Could someone give me some suggestions?:confused: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

    M 1 Reply Last reply
    0
    • C Chaos Lawful

      I'm writing a multi-threaded FTP sites and contents searching program using WININET lib. When I search the contents in a FTP site, I have to enumerate the files under a directory. But when I use MFC's CFtpFileFind class, it terminated with a error message at FtpFindFirstFile() when there're some thousands of files under the directory. I tried many times but it still failed. I can't solve this problem. Could someone give me some suggestions?:confused: Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      What's the error message? Post some code. --Mike-- http://home.inreach.com/mdunn/ Trillian: What are you supposed to do with a manically depressed robot? Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?

      C 1 Reply Last reply
      0
      • M Michael Dunn

        What's the error message? Post some code. --Mike-- http://home.inreach.com/mdunn/ Trillian: What are you supposed to do with a manically depressed robot? Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?

        C Offline
        C Offline
        Chaos Lawful
        wrote on last edited by
        #3

        Sorry, I'm using Win 2k Simplified Chinese version, so I don't know what the error message is in English. But I think it should be something like "0xxxxxx" instruction referenced to "xxxxxxxx" address error, the memory cannot be 'read'. Here is the content searching function: void MultiThreadSearch::IterFind( CFtpConnection *pFTP, LPCTSTR szStrToFind, LPCTSTR dircontent, int maxdepth, BOOL bOmit, int index, int depth) { MSG msg; CStringArray csDirectories; long directories=0; BOOL bFlag=FALSE; BOOL bNeedSearch=TRUE; if(maxdepth!=-1&&depth>maxdepth) return; CMyFtpFileFind finder(pFTP); bFlag=finder.FindFile(NULL,INTERNET_FLAG_DONT_CACHE| INTERNET_FLAG_RESYNCHRONIZE); while(bFlag) { if(bQuit) { return; } if(::PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } bFlag=finder.FindNextFile(); CString yytemp=szMainTitle; yytemp+=finder.MyGetFileURL(); (AfxGetApp()->GetMainWnd())->SetWindowText(yytemp); bNeedSearch=FALSE; if(finder.IsDirectory()|| finder.MatchesMask(FILE_ATTRIBUTE_REPARSE_POINT)) { BOOL bResult=FALSE; if(finder.IsDirectory()) { if(finder.IsDots()) { bResult=TRUE; } } if(bResult) { continue; } if(depth<=maxdepth) { CString xxx=finder.GetFileName(); if(dircontent==NULL) { bNeedSearch=TRUE; } else if(bOmit) { xxx.MakeUpper(); if(xxx.Find(dircontent)!=-1) { bNeedSearch=TRUE; } } else if(xxx.Find(dircontent)!=-1) { bNeedSearch=TRUE; } if(bQuit) { return; } if(bNeedSearch) { directories++; CString ttt=finder.GetFileName(); csDirectories.Add(ttt); BOOL bGotIt=FALSE; if(bOmit) { ttt.MakeUpper(); LPSTR pStr=ttt.LockBuffer(); if(regular.Search(pStr)) { bGotIt=TRUE; } ttt.UnlockBuffer(); } else { LPSTR pStr=ttt.LockBuffer(); if(regular.Search(pStr)) { bGotIt=TRUE; } ttt.UnlockBuffer(); } if(bQuit) { return; } if(bGotIt) { CString xx=finder.MyGetFilePath(); CWftp1Dlg *pDlg=(CWftp1Dlg*)CWftp1Dlg::FromHandle(hWnd); CTreeCtrl *pTree=(CTreeCtrl*)pDlg->GetDlgItem(IDC_TREE_FTPS); pTree->InsertItem(xx, *((HTREEITEM*)arAllFTPs.GetAt(index))); pTree->Expand(*((HTREEITEM*)arAllFTPs.GetAt(index)), TVE_EXPAND); } } }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups