Solved

Detecting if the computer is on-line

Posted on 2000-04-03
7
138 Views
Last Modified: 2013-11-20
The function InternetOpenUrl () generates a Dial-up Connection dialog box.  If you select cancel it flashes back up twice more.

How do I detect the user has selected cancel and avoid flashing up irritating Dial-up Connection dialog box.
0
Comment
Question by:denmead
7 Comments
 
LVL 9

Expert Comment

by:cdesigner
ID: 2681303
use Ping
try to find code for Ping on codeguru - many, many classes can make this
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 50 total points
ID: 2682965
Hi denmead,

since NT4 and Win95 there's an API command InternetGetConnectedState().
To use it you'll have to include 'wininet.h' and link with 'wininet.lib'.

See MSDN article ID: Q242558 for further infos on this...

hope that helps,

ZOPPO
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2683732
ZOPPO

I think InternetGetConnectedState has been broken in IE5 - my program which works perfectly well with IE4 does not work with IE5.

If the app is running and IE goes offline - then my app notices this. However if my app is started when IE is offline my app will actually say IE is online.

Could you check this and make sure I am not going mad. (only if you have time of course - If you think I should, I'll post it as a question but, I am not sure how to phrase it or how to judge the answer)

Whenever anyone asks this question 'our' response is always to say InternetGetConnectedState etc and I want to make sure we are not giving duff advice.

I think it is related to the wininet library being initialised for the first time for an app - but I can't put my finger on it.

My simple test app was a dialog only app with a 1 second WM_TIMER message going off and it was displaying its info (dwState) to a CStatic. and the only function it called was InternetGetConnectedState(...).

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2683860
ZOPPO

I think InternetGetConnectedState has been broken in IE5 - my program which works perfectly well with IE4 does not work with IE5.

If the app is running and IE goes offline - then my app notices this. However if my app is started when IE is offline my app will actually say IE is online.

Could you check this and make sure I am not going mad. (only if you have time of course - If you think I should, I'll post it as a question but, I am not sure how to phrase it or how to judge the answer)

Whenever anyone asks this question 'our' response is always to say InternetGetConnectedState etc and I want to make sure we are not giving duff advice.

I think it is related to the wininet library being initialised for the first time for an app - but I can't put my finger on it.

My simple test app was a dialog only app with a 1 second WM_TIMER message going off and it was displaying its info (dwState) to a CStatic. and the only function it called was InternetGetConnectedState(...).

0
 

Author Comment

by:denmead
ID: 2684956
I don't think ping is the way to do it.

I like the look of the InternetGetConnectedState () so I think I will try that.

Q242558 says use InternetOpenURL () when you want to try to connect.  But this give three dial-up dialog boxes if you click on cancel.

IE5 gives a dialog box with an off-line button.

How do they do that?

0
 

Author Comment

by:denmead
ID: 2685049

I've found what looks like a good answer to my question at:

http://msdn.microsoft.com/workshop/components/offline/offline.asp
0
 

Author Comment

by:denmead
ID: 2685054
Thanks Zoppo you pointed me in the right direction
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
iSeries DB2 Query 2 97
VBA "SendKeys" Syntax for Multiple Keystrokes 7 117
sumHeights2  challenge 7 114
Fibonacci challenge 11 132
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question