*Form.init thisform.hOpen = InternetOpen("My Connection", INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0) if thisform.hOpen = 0 messagebox("Couldn't start inet") return .F. EndIf thisform.dwSemantic = 0 thisform.hConnection = 0 *Connect button.click With thisform If .hConnection # 0 InternetCloseHandle( .hConnection ) Endif .hConnection = InternetConnect(.hOpen, ; trim(.txtURL.Value), ; INTERNET_INVALID_PORT_NUMBER, ; trim(.txtUser.Value), ; trim(.txtPWD.Value), ; INTERNET_SERVICE_FTP, ; .dwSemantic, 0) If .hConnection=0 .FtpResponse('Error connecting server') Else .FtpResponse('Connected.') Endif Endwith *Disconnect/close With thisform If .hConnection # 0 Then If InternetCloseHandle( .hConnection ) = 0 .FtpResponse('Error disconnecting.') Else .FtpResponse('Disconnected.') .hConnection = 0 Endif Endif EndwithFtpResponse calls wininet dlls to get last response info and formats the messages to show connection and other dialogs. For this piece of code you could use messagebox instead.