home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,800 of 10,840   
   Rico to Clif McIrvin   
   Re: Having an FTP code issue   
   09 Sep 09 14:18:17   
   
   XPost: microsoft.public.access   
   From: me@you.com   
      
   Thanks for the response Clif.  I thought I had exhausted my Google   
   searching, but will give it a nother try.   
      
   Rick   
      
   "Clif McIrvin"  wrote in message   
   news:O03JqcVMKHA.4028@TK2MSFTNGP05.phx.gbl...   
   > Rico - sounds like you're making a reasonable presumed diagnosis ... Have   
   > you looked for forums targeted to using APIs? I have extremely limited   
   > experience working with APIs; I do recall having had some success using   
   > advanced google searching of microsoft.com for documentation of API calls   
   > in the past.   
   >   
   > Happy Hunting!   
   > --   
   > Clif   
   >   
   > "Rico"  wrote in message   
   > news:DMzpm.44220$PH1.33225@edtnps82...   
   >> Anyone?  Any clues at all?   
   >>   
   >> "Rico"  wrote in message   
   >> news:DLwnm.43507$PH1.7095@edtnps82...   
   >>> Hi All,   
   >>>   
   >>> I have an FTP routine in my A2K2 database that I am using to transfer   
   >>> files. When I call the FtpFindFirstFile API, I get an error 12002 which   
   >>> is a timeout error.  I've removed the timeout from the FTP server, but I   
   >>> still get this error.  I read that the files can can only be enumerated   
   >>> once using this function and if it's called again, it will produce an   
   >>> error.  I think this is what is happening, since when I close the   
   >>> database and re-open it, I can run this function for the first time   
   >>> without issue.   
   >>>   
   >>> My question is, how do I tell if the files / folders have been   
   >>> enumerated once already and how can I reset this so I can enumerate   
   >>> again?  This is the function that is giving me problems;   
   >>>   
   >>> Public Sub GetFileNames(Optional pRemoteDir, Optional pFileSpec)   
   >>> 'Fill the FileNames collection with list   
   >>> 'of files matching pFileSpec from server's   
   >>> 'current directory   
   >>>   
   >>>    Dim hFind As Long   
   >>>    Dim LastErr As Long   
   >>>    Dim fdata As WIN32_FIND_DATA   
   >>>    '   
   >>>    'Bail out if server connection not established   
   >>>    If m_hCon = 0 Then RaiseError errNotConnected   
   >>>    '   
   >>>    'Handle optional parameters   
   >>>    If Not IsMissing(pRemoteDir) Then m_RemoteDir = pRemoteDir   
   >>>    If Not IsMissing(pFileSpec) Then m_FileSpec = pFileSpec   
   >>>    '   
   >>>    'Handle empty properties   
   >>>    If Len(m_RemoteDir) = 0 Then m_RemoteDir = "."   
   >>>    If Len(m_FileSpec) = 0 Then m_FileSpec = "*.*"   
   >>>    '   
   >>>   
   >>>    ClearFileNames   
   >>>   
   >>>    'Change directory on server   
   >>>    Me.SetDir m_RemoteDir   
   >>>    '   
   >>>    'Find first file matching FileSpec   
   >>>    fdata.cFileName = String(MAX_PATH, 0)   
   >>>    'Obtain search handle if successful   
   >>>    'FtpSetCurrentDirectory m_hCon, "."   
   >>>   
   >>>    hFind = FtpFindFirstFile(m_hCon, m_FileSpec, fdata, 0, 0)   
   >>>    LastErr = Err.LastDllError   
   >>>    If hFind = 0 Then   
   >>>        'Bail out if reported error isn't end-of-file-list   
   >>>        If LastErr <> ERROR_NO_MORE_FILES Then   
   >>>            RaiseError errFindFirst   
   >>>        End If   
   >>>        'Must be no more files   
   >>>        Exit Sub   
   >>>    End If   
   >>>    '   
   >>>    'Reset variable for next call   
   >>>    LastErr = NO_ERROR   
   >>>    '   
   >>>    'Add filename to the collection   
   >>>    FileNames.Add Left(fdata.cFileName, _   
   >>>        InStr(1, fdata.cFileName, vbNullChar, vbBinaryCompare) - 1)   
   >>>    Do   
   >>>        'Find next file matching FileSpec   
   >>>        fdata.cFileName = String(MAX_PATH, 0)   
   >>>        If InternetFindNextFile(hFind, fdata) = False Then   
   >>>            LastErr = Err.LastDllError   
   >>>            If LastErr = ERROR_NO_MORE_FILES Then   
   >>>                'Bail out if no more files   
   >>>                Exit Do   
   >>>            Else   
   >>>                'Must be a 'real' error   
   >>>                InternetCloseHandle hFind   
   >>>                RaiseError errFindNext   
   >>>            End If   
   >>>        Else   
   >>>            'Add filename to the collection   
   >>>            FileNames.Add Left(fdata.cFileName, _   
   >>>                InStr(1, fdata.cFileName, vbNullChar, vbBinaryCompare) -   
   >>> 1)   
   >>>       End If   
   >>>    Loop   
   >>>    '   
   >>>    'Release the search handle   
   >>>    InternetCloseHandle hFind   
   >>>   
   >>> End Sub   
   >>>   
   >>> Thanks!   
   >>> Rick   
   >>>   
   >>>   
   >>   
   >>   
   >   
   >   
   >   
   > --   
   > Clif   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca