bool IsConnected
{
get
{
int flags = 0;
return InternetGetConnectedStateEx(out flags, 0, 0, 0);
}
}
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedStateEx(out InetFlags
flags, int reservedValue, int dwNameLen, int dwReserved);
In which namespace is the InetFlags ? Cann't find it or maybe I'm
overlooking something.
Regards
Peter
Sergey Bogdanov said:
You may try this:
bool IsConnected
{
get
{
int flags = 0;
return InternetGetConnectedStateEx(out flags, 0, 0, 0);
}
}
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedStateEx(out InetFlags
flags, int reservedValue, int dwNameLen, int dwReserved);
// Flags for InternetGetConnectedState and Ex
#define INTERNET_CONNECTION_MODEM 0x01
#define INTERNET_CONNECTION_LAN 0x02
#define INTERNET_CONNECTION_PROXY 0x04
#define INTERNET_CONNECTION_MODEM_BUSY 0x08 /* no longer used */
#define INTERNET_RAS_INSTALLED 0x10
#define INTERNET_CONNECTION_OFFLINE 0x20
#define INTERNET_CONNECTION_CONFIGURED 0x40
Regards
ACP
Peter said:
Hello Sergey,
In which namespace is the InetFlags ? Cann't find it or maybe I'm
overlooking something.
Regards
Peter
Sergey Bogdanov said:
You may try this:
bool IsConnected
{
get
{
int flags = 0;
return InternetGetConnectedStateEx(out flags, 0, 0, 0);
}
}
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedStateEx(out InetFlags
flags, int reservedValue, int dwNameLen, int dwReserved);
In which namespace is the InetFlags ? Cann't find it or maybe I'm
overlooking something.
Regards
Peter
You may try this:
bool IsConnected
{
get
{
int flags = 0;
return InternetGetConnectedStateEx(out flags, 0, 0, 0);
}
}
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedStateEx(out InetFlags
flags, int reservedValue, int dwNameLen, int dwReserved);
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.