Solved

Detecting if the computer is on-line

Posted on 2000-04-03
7
139 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

713 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