Darren66 Posted June 9, 2003 Posted June 9, 2003 I am a newbie to VB.net and have been reading manuals but would appreciate it if somebody could point me in the right direction. I want to click a button and connect to the internet if not already connected - something which I achieved in VB6 with wininet.dll. Is there a better way of doing this now in .net?? Quote
Darren66 Posted June 10, 2003 Author Posted June 10, 2003 Or let me rephrase that : It seems to me that InternetConnect API Works in VB6 but not VB .NET Any suggestions? Quote
*Gurus* divil Posted June 10, 2003 *Gurus* Posted June 10, 2003 Can you paste your declare for that API in VB.NET? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Darren66 Posted June 10, 2003 Author Posted June 10, 2003 I ran this code through the upgrade wizard from VB6 to VB.net and this was the result. I noticed that the data types have been changed from Longs to Integers however I changed tried changing them back to Longs with no success. The first piece of code is from my form and is the line which attempts to make the connection. <code> hConnection = InternetConnect(hOpen, "ftp.mysite.com", INTERNET_INVALID_PORT_NUMBER, "user", "password", INTERNET_SERVICE_FTP, dwSeman, 0) </code> <code> Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _ (ByVal hInternetSession As Integer, ByVal sServerName As String, ByVal nServerPort As Short, ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Integer, ByVal lFlags As Integer, ByVal lContext As Integer) As Integer Public Declare Function InternetCloseHandle Lib "wininet.dll" _ (ByVal hInet As Integer) As Integer Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _ (ByVal sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Integer) As Integer </code> Quote
Darren66 Posted June 10, 2003 Author Posted June 10, 2003 Divil Typically I think I've just managaed to get it working although at this point I'm not quite sure how. I hope I haven't wasted your time. Many Thanks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.