Network Connection

Hi All,

How to detect the status of the network connection,

I hope my application can pop-up a dialog to notice the user when the connection has been disconnected.
Note: I want to do the same thing as the software ICQ.

Also, the network may be connected by using the dial-up networking or at the LAN.

How can I do this?

Thank you very much for your help!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BOOL InternetGetConnectedState(
    OUT LPDWORD lpdwFlags,
    IN DWORD dwReserved

Declared in WININET.H and links with WININET.LIB.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HOWTO: Detecting If You Have a Connection to the Internet
ee_lcpaaAuthor Commented:
Dear jhance & chensu,

I am using the Visual C++ 5.0 Professional Edition to implement my application. After including the file <wininet.h> and linking with the file wininet.lib, I still cannot use the function InternetGetConnectedState.

What is the problem about this?


Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

You need the latest Platform SDK, which can be found on MSDN CDs or can be downloaded at
The version of VC++ is not relevant, but your header files are out of date.

Specifically, you need WININET.H and WININET.LIB out of the current SDK.  

The function InternetGetConnectedState() itself is in WININET.DLL included on any Windows system with IE4.0 or later installed.
ee_lcpaaAuthor Commented:
Hi jhance and chensu,

My PC had already installed IE 5.0. I still cannot use the function

Furhter, I have installed the Microsoft Platform SDK (January 2000) at my PC. But I found the header file wininet.h and the lib file wininet.lib had not been changed also.

I found Only the wininet.dll had been updated.

Can you tell me how can I obtain the update version of the file wininet.h and wininet.lib?

Thank you very much!!!
>But I found the header file wininet.h and the lib file wininet.lib had not been changed also.

You must have looked at the Visual C++ directories. The Platform SDK is installed separately. By default, it is in the \Program Files\Platform SDK directory. You need to change your Visual C++ options (menu Tools/Options..., Directories tab) so that it uses the Platform SDK header files and library files.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.