Hello,
I've looked high and low for an answer on this.
I'm connecting VB.NET to our mainframe server using the following command
connect = InternetConnect(hOpen, sPlat, INTERNET_INVALID_PORT_NUMBER, user, pass, INTERNET_SERVICE_FTP, dwSeman, 0)
All is well for this. I can download a file using the FtpGetFile command using the connect variable.
My issue here is trying to create a directory listing for navigation. Seems the easiest way would be to use the FtpFindFirstFile method.
Here is my [relative] code that I am trying:
Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, ByVal lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
Private Const INTERNET_FLAG_RELOAD = &H80000000
Public Const INTERNET_FLAG_NO_CACHE_WRITE = &H4000000
Private Structure WIN32_FIND_DATA
Public dwFileAttributes As Integer
Public ftCreationTime As Long
Public ftLastAccessTime As Long
Public ftLastWriteTime As Long
Public nFileSizeHigh As UInteger
Public nFileSizeLow As UInteger
Public dwReserved0 As Integer
Public dwReserved1 As Integer
Public cFileName As String
Public cAlternate As String
End Structure
Public Function GetDirectoryListing(ByVal sFilter As String, ByVal connect As Integer) As IList
Dim pData As WIN32_FIND_DATA
Dim hFind As Integer
hFind = FtpFindFirstFile(connect, sFilter, pData, INTERNET_FLAG_RELOAD Or INTERNET_FLAG_NO_CACHE_WRITE, 0&)
During run time, I get a warner of "PInvokeStackImbalance was detected"
The error received after executing the step anyway is as follows:
"OverflowException was unhandled
Arithmetic operation resulted in an overflow"
Any help is appreciated. It would be nice to get a navigation type GUI added to this.