control dial up connection

  • Thread starter Thread starter news dur Wanadoo
  • Start date Start date
N

news dur Wanadoo

Dear all,

I need to writte a VB application that establish a dial up connection to the
internet, upload and file on a ftp, then close the connection.

what's the easiest way to do it ?

Thanks for help,
Loïc
 
news dur Wanadoo said:
Dear all,

I need to writte a VB application that establish a dial up connection to the
internet, upload and file on a ftp, then close the connection.

what's the easiest way to do it ?

Thanks for help,
Loïc

My apologies for not converting this dialup code to VB, but it is at least a
pointer in the right direction :)

http://authors.aspalliance.com/aldotnet/examples/translate.aspx should help
with the conversion...

The indy project at http://www.indyproject.org/ has a ftp client that should
work for the rest.

// Requires IE >= v5.0

using System;
using System.Runtime.InteropServices;

public class RASDialup
{

[DllImport("wininet.dll",CharSet=CharSet.Auto)]
public extern static int InternetDial(

IntPtr hwnd,

[In]string lpszConnectoid,

uint dwFlags,

ref int lpdwConnection,

uint dwReserved

);

[DllImport("wininet.dll",CharSet=CharSet.Auto)]

public extern static int InternetHangUp(

int lpdwConnection,

uint dwReserved

);

public enum DialUpOptions

{

INTERNET_AUTODIAL_FORCE_ONLINE = 0x0001,

INTERNET_AUTODIAL_FORCE_UNATTENDED = 0x0002,

INTERNET_DIAL_FORCE_PROMPT =0x2000,

INTERNET_DIAL_SHOW_OFFLINE =0x4000,

INTERNET_DIAL_UNATTENDED =0x8000

/*

INTERNET_AUTODIAL_FORCE_ONLINE Forces an online connection.

INTERNET_AUTODIAL_FORCE_UNATTENDED Forces an unattended Internet dial-up. If
user intervention is required, the function will fail.

INTERNET_DIAL_FORCE_PROMPT Ignores the "dial automatically" setting and
forces the dialing user interface to be displayed.

INTERNET_DIAL_UNATTENDED Connects to the Internet through a modem, without
displaying a user interface, if possible. Otherwise, the function will wait
for user input.

INTERNET_DIAL_SHOW_OFFLINE

*/

}

int m_connectionnumber;

public int ConnectionNumber

{

get { return m_connectionnumber; }

}

public int Connect(string m_ConnectionName)

{

int retVal = InternetDial(IntPtr.Zero, m_ConnectionName, (uint)
DialUpOptions.INTERNET_DIAL_UNATTENDED, ref m_connectionnumber, 0);

return retVal;

}

public void Disconnect()

{

InternetHangUp(m_connectionnumber, 0);

}

}
 
Back
Top