//sample code#include "stdafx.h"#include "stdio.h"#include <Sensapi.h>#pragma comment(lib, "Sensapi.lib") int main(int argc, char argv []){ DWORD dw; if( ! IsNetworkAlive(&dw)) { // error or no connection DWORD const e = GetLastError(); if( e == ERROR_SUCCESS) { printf("No connection!\n"); } else { printf("Connection error!\n"); } } else { printf("Connected to network!\n"); if(dw == NETWORK_ALIVE_LAN) { //The computer has one or more LAN cards that are active } else if(dw == NETWORK_ALIVE_WAN) { // The computer has one or more active RAS connections. } else { //invalid flag } }}