Try this:
[DllImport ("wininet.dll")]
private extern static bool InternetSetOption (int hInternet,
int dwOption,
ref INTERNET_CONNECTED_INFO lpBuffer,
int dwBufferLength
);
[StructLayout(LayoutKind.Sequential)]
struct INTERNET_CONNECTED_INFO
{
public int dwConnectedState;
public int dwFlags;
} ;
INTERNET_CONNECTED_INFO ci = new INTERNET_CONNECTED_INFO ();
// To set online use 1 for dwConnectedState member
ci.dwConnectedState = 0x10; //INTERNET_STATE_DISCONNECTED
ci.dwFlags = 1; //ISO_FORCE_DISCONNECTED
InternetSetOption (0, 50, ref ci, Marshal.SizeOf (ci)); //50 -
INTERNET_OPTION_CONNECTED_STATE
Hi!
How can I code the Work Offline function using Wininet and
InternetSetOption. I found some stuff in VB and Delphi but not in C# :-(
~Matt
Mateusz Rajca - 05 Oct 2006 03:59 GMT
Thanks! It sets it offline perfecto. Now how do i set it back online?
~Matt
> Try this:
>
[quoted text clipped - 27 lines]
>
> ~Matt
Mateusz Rajca - 05 Oct 2006 21:23 GMT
Please reply
> Try this:
>
[quoted text clipped - 27 lines]
>
> ~Matt
Siva M - 06 Oct 2006 01:12 GMT
As noted in the code, set dwConnectedState to 1; dwFlags is not required.
Please reply
"Siva M" wrote:
> Try this:
>
[quoted text clipped - 27 lines]
>
> ~Matt