Solved

Detecting if the computer is on-line

Posted on 2000-04-03
7
137 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Running shell command from Access 3 75
Turn a spreadsheet into a vba executable. 2 86
twoTwo  challenge 35 103
Increment column based of a FK 8 21
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 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