I posted this in the Access thread, but seeing as how this is a VB problem, I thought this might be the better place
I have a code to FTP files to a server, using a script FTP.scr.
I need to wait until the FTP completes before proceeding to the next code. So far every process I have written keeps failing, and I'm not sure where I'm going wrong.
This is the code as I have it now:
I would really appreciate it if anyone had either a link ot a good resource on writing a process, or if anyone can help me wiht what this process would/should look like.
I haven't really written processes before - this is a new area of vb for me.
Thanks for any help anyone can provide.
I have a code to FTP files to a server, using a script FTP.scr.
I need to wait until the FTP completes before proceeding to the next code. So far every process I have written keeps failing, and I'm not sure where I'm going wrong.
This is the code as I have it now:
Code:
Public Sub FTP_Shell(SCR_FILE As String)
Dim FTP_Task As Long, ret As Long, FTP_Handle As Long
Dim FTP_PROCESS As String
Dim stSysDir As String
stSysDir = Environ$("COMSPEC")
stSysDir = Left$(stSysDir, Len(stSysDir) - Len(Dir(stSysDir)))
FTP_PROCESS = CreateProcessA(sNull, p_Path, ByVal 0&, ByVal 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo)
FTP_Task = Shell(stSysDir & "ftp.exe -s:" & stSCRFile, vbNormalFocus)
FTP_Handle = OpenProcess(FTP_PROCESS, False, FTP_Task)
ret = WaitForSingleObject(FTP_Handle, INFINITE)
ret = CloseHandle(FTP_Handle)
End Sub
Function TEST_FTP_FILES()
Call FTP_Shell("C:\DLU\System\FTP\Test_FTP.scr")
End Function
I haven't really written processes before - this is a new area of vb for me.
Thanks for any help anyone can provide.
Comment