Solved

Detecting if the computer is on-line

Posted on 2000-04-03
7
136 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 56
iSeries FTP Exit Program 8 124
My project did see openJDK that I installed. What could be the problem 7 124
firstChar challenge 13 110
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

19 Experts available now in Live!

Get 1:1 Help Now