InternetDial - like method in .NET

  • Thread starter Thread starter Borr
  • Start date Start date
B

Borr

Hi,

I am developing in Visual Studio .NET 2003

I am writing a Windows application, that should connect to
Web service on remote host, get some data and display it.
I'd like to check whether the computer connected to
Internet, and, if not connected, connect to it from the
application before I call the web service.

There are InternetGetConnectedState() and InternetDial()
methods for this purpose in Platform SDK, but they are
called from C++ only. How to call them from C# code ? May
be, there is something like instead in .NET framework ?

Thanks,

Borr
 
Hi,

You can call the SDK methods with P/Invoke. Declare them as "public static
extern" and apply the properly formed DllImportAttribute to specify the DLL
containing these functions and other relevant settings.

Having done that, you will be able to call these just like any other static
methods.
 
Back
Top