Click here to Skip to main content
15,900,378 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Questionhow to customize MS OFFICE using WINDOWS API's..? Pin
pradpb99927-Dec-05 22:18
pradpb99927-Dec-05 22:18 
AnswerRe: how to customize MS OFFICE using WINDOWS API's..? Pin
Colin Angus Mackay29-Dec-05 0:24
Colin Angus Mackay29-Dec-05 0:24 
QuestionDelegates and Asynchronous Calls Pin
HakunaMatada27-Dec-05 17:14
HakunaMatada27-Dec-05 17:14 
AnswerRe: Delegates and Asynchronous Calls Pin
tarasn30-Dec-05 3:17
tarasn30-Dec-05 3:17 
Questionmaking combobox scrollbox wider Pin
plukje26-Dec-05 23:37
plukje26-Dec-05 23:37 
AnswerRe: making combobox scrollbox wider Pin
S. Akif Kamal27-Dec-05 3:29
S. Akif Kamal27-Dec-05 3:29 
QuestionChecking Internet connectivity Pin
analytiks26-Dec-05 20:38
analytiks26-Dec-05 20:38 
AnswerRe: Checking Internet connectivity Pin
HakunaMatada28-Dec-05 0:38
HakunaMatada28-Dec-05 0:38 
How do I detect if there is an Internet connection?[^]

It is sometimes useful for a Winsock program to only do its thing if the computer is already connected to the Internet. In many cases, "connected to the Internet" means having a dial-up networking connection. See this example for code that checks for such a connection.

This doesn't work in all situations, however. The first problem is, not everyone uses a modem to connect to the Internet. Often a computer is hooked to a LAN, and one of the stations on the LAN acts as a gateway to the Internet. You could poke around in the system's network configuration to see if they have a gateway configured, but then you run into the problem that gateways are used for things other than simply connecting a LAN to the Internet. Even if the LAN is sometimes gatewayed to the Internet, the gateway's Internet connection might not always be up, or it might be configured to block access to some sites.

Another issue is that even if the PC does have a modem for connecting to the Internet, it might be disconnected but configured to auto-dial. In this case, the fact that the modem is currently disconnected is not a problem: your program should blindly try to connect, which will bring the connection up.

The moral of the story is, it's usually best not to even check for an Internet connection. Simply assume that the user knows what they're doing by launching your program. Try the connection, and if it fails because there is no Internet connection, you can tell the user about it and leave fixing the problem up to the user. You might also consider making your program's connection handling user-configurable: let the user tell you whether it's correct to check for a dial-up networking connection or not, and whether your program should blindly try the connection or not. Often the user knows more about their system than your program can guess.



---
With best regards,
A Manchester United Fan

The Genius of a true fool is that he can mess up a foolproof plan!
QuestionProblem in Running WebApplication in Visual Studio.Net Pin
v.s.s.sundar25-Dec-05 20:19
v.s.s.sundar25-Dec-05 20:19 
AnswerRe: Problem in Running WebApplication in Visual Studio.Net Pin
VenkataRamana.Gali27-Dec-05 8:10
VenkataRamana.Gali27-Dec-05 8:10 
QuestionCheck for an objects subscription to an event Pin
analytiks25-Dec-05 20:09
analytiks25-Dec-05 20:09 
AnswerRe: Check for an objects subscription to an event Pin
HakunaMatada25-Dec-05 20:20
HakunaMatada25-Dec-05 20:20 
GeneralRe: Check for an objects subscription to an event Pin
analytiks26-Dec-05 17:14
analytiks26-Dec-05 17:14 
GeneralRe: Check for an objects subscription to an event Pin
HakunaMatada26-Dec-05 17:28
HakunaMatada26-Dec-05 17:28 
GeneralRe: Check for an objects subscription to an event Pin
analytiks26-Dec-05 17:56
analytiks26-Dec-05 17:56 
GeneralRe: Check for an objects subscription to an event Pin
umesh kanyal28-Dec-05 0:21
umesh kanyal28-Dec-05 0:21 
AnswerRe: Check for an objects subscription to an event Pin
S. Senthil Kumar26-Dec-05 19:16
S. Senthil Kumar26-Dec-05 19:16 
GeneralRe: Check for an objects subscription to an event Pin
analytiks26-Dec-05 19:41
analytiks26-Dec-05 19:41 
Questionmedia player for pda Pin
pgcnet25-Dec-05 1:55
pgcnet25-Dec-05 1:55 
QuestionSetting attributes to folders Pin
Yevgeny Efter24-Dec-05 18:50
Yevgeny Efter24-Dec-05 18:50 
AnswerRe: Setting attributes to folders Pin
VenkataRamana.Gali27-Dec-05 8:04
VenkataRamana.Gali27-Dec-05 8:04 
QuestionToolstrip Pin
kenexcelon24-Dec-05 16:59
kenexcelon24-Dec-05 16:59 
QuestionSetting Min/Max size for FormViews and Dialogs Pin
brdavid24-Dec-05 2:37
brdavid24-Dec-05 2:37 
AnswerRe: Setting Min/Max size for FormViews and Dialogs Pin
S. Akif Kamal27-Dec-05 20:48
S. Akif Kamal27-Dec-05 20:48 
GeneralRe: Setting Min/Max size for FormViews and Dialogs Pin
brdavid2-Jan-06 14:52
brdavid2-Jan-06 14:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.