using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Win32;
using System.Net.Sockets;
using System.Runtime.InteropServices;
//use above as Declarations
class Dial
{
const int INTERNET_CONNECTION_MODEM = 1;
const int INTERNET_CONNECTION_LAN = 2;
const int INTERNET_CONNECTION_PROXY = 4;
const int INTERNET_CONNECTION_MODEM_BUSY = 8;
public const int INTERNET_DIAL_UNATTENDED = 0x8000;
const int INTERNET_AUTODIAL_FORCE_ONLINE = 1;
const int INTERNET_AUTODIAL_FORCE_UNATTENDED = 2;
const int INTERNET_AUTODIAL_FAILIFSECURITYCHECK = 4;
[DllImport("wininet.dll")]
private extern static int InternetDial(IntPtr hwndParent, string lpszConnectoid, int dwFlags, out int lpdwConnection, int dwReserved);
private int m_mlConnection = 0; private bool m_isConnected = false;
public int DialUp()
{ m_mlConnection = 0;
//MessageBox.Show(m_mlConnection.ToString());
int zez = //!!!This is part of code that we are using for call InternetDial
InternetDial(IntPtr.Zero,"DefaultDialUp",INTERNET_DIAL_UNATTENDED,out m_mlConnection,0);
return 0;
}
}
//This is the Part of the Coding For calling the Dial Object
private void button1_Click(object sender, EventArgs e)
{
Dial obj = new Dial();
obj.DialUp();
}
No comments:
Post a Comment