Solved

Detecting if the computer is on-line

Posted on 2000-04-03
7
135 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 30

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now