Getting Notified Regarding Internet Connections

Environment: Win95, Win98, WinME, WinNT, Win2K, WinXP

I have been looking for some time how to get notified when the user connects to Internet just as MSN or Yahoo Messenger starts the login procedure, as soon as the user connects to Internet. At CodeGuru and other discussion forums, the way people suggested was more of a work-around like pinging a server or IP address after some time interval.

There is a Win32 API, RasConnectionNotification, that I guess applications such as MSN and Yahoo Messenger use to get notified. To use this API, we first need to create an Event Object, using CreateEvent; then we pass the EvenObject created by CreateEvent to RasConnectionNotification (to be signaled by System when Ras Connection is made), and then we wait for the Ras Connection Event to happen using the Wait Function WaitForSingleObject.

Downloads

Download demo project - 4 Kb
Download source - 33 Kb


Comments

  • Re: CABEL MODEM

    Posted by Legacy on 02/20/2003 12:00am

    Originally posted by: Usman

    I never tried it (dont have access to it :( ). But if it uses the RAS32 API then it should work.
    Regards,
    Usman.

    Reply
  • How can i blcock dial-up connections where phonenumbers begin with

    Posted by Legacy on 02/14/2003 12:00am

    Originally posted by: Andreas

    hi folks,
    How can i blcock dial-up connections where phonenumbers begins with i.e zero
    or block dial ups by specified phonenumbers
    (reading out of a file or listbox )
    Andreas

    Reply
  • Re: If Already Connected

    Posted by Legacy on 01/04/2003 12:00am

    Originally posted by: long_double

    As it was prevoiusly noted you won't get notified this way about already established connection to the Internet. You can retrieve the connected state of the local system using "InternetGetConnectedState(Ex)". It will show you whether the established connection you have is a Dial-Up connection or LAN and whether a client uses a Proxy server or not.

    Cheers.

    Reply
  • Win95 ...

    Posted by Legacy on 08/14/2002 12:00am

    Originally posted by: rb

    You should be aware, that DUN 1.3 must be installed on Win95 machines in order to use function RasConnectionNotification().

    rb

    Reply
  • Only for Dial-Up Connections ?

    Posted by Legacy on 08/13/2002 12:00am

    Originally posted by: sunil

    I would like to know whether the notification from RAS is only for dial-up connection? In my opinion in Intranet/ office environment we are always connected.

    Reply
  • How can I block Internet Access Programatically ?

    Posted by Legacy on 08/12/2002 12:00am

    Originally posted by: Yusak Setiawan

    How can I block Internet Access Programatically in Win9x or NT/2K

    Thanks

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 13, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT APIs can be a great source of competitive advantage. The practice of exposing backend services as APIs has become pervasive, however their use varies widely across companies and industries. Some companies leverage APIs to create internal, operational and development efficiencies, while others use them to drive ancillary revenue channels. Many companies successfully support both public and private programs from the same API by varying levels …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds