Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2006

Tip: Looking for answers? Try searching our database.

WinInet C# - InternetSetOption

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mateusz Rajca - 05 Oct 2006 00:23 GMT
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
Siva M - 05 Oct 2006 02:20 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.