有好的方案了。(可惜是VC++的代码)<br>Getting Notified Regarding Internet Connections <br><br>--------------------------------------------------------------------------------<br>This article was contributed by Muhammad Usman Riaz.. <br>Environment: Win95, Win98, WinME, WinNT, Win2K, WinXP <br><br>I have been looking for some time how to get notified when the user <br>connects to Internet just as MSN or Yahoo Messenger starts the login <br>procedure, as soon as the user connects to Internet. At CodeGuru and <br>other discussion forums, the way people suggested was more of a <br>work-around like pinging a server or IP address after some time interval.<br><br>There is a Win32 API, RasConnectionNotification, that I guess applications <br>such as MSN and Yahoo Messenger use to get notified. To use this API, <br>we first need to create an Event Object, using CreateEvent; then we pass <br>the EvenObject created by CreateEvent to RasConnectionNotification <br>(to be signaled by System when Ras Connection is made), and then we <br>wait for the Ras Connection Event to happen using the Wait Function <br>WaitForSingleObject.<br><br>