public static bool IsHNetCfgWayConnected(string opName)
{
NetSharingManagerClass netSharingMgr = new NetSharingManagerClass(); INetSharingEveryConnectionCollection connections = netSharingMgr.EnumEveryConnection;
List<object> conns = new List<object>();
foreach (INetConnection connection in connections)
{
INetConnectionProps connProps = netSharingMgr.get_NetConnectionProps(connection);
if (connProps.MediaType == tagNETCON_MEDIATYPE.NCM_LAN)
{
if (connProps.Name.Equals(opName))
{
return connProps.Status == tagNETCON_STATUS.NCS_CONNECTED;
}
}
}
return false;
}