You have defined all the necessary callback functions, which is great. But you must register for these events by invoking the βadviseβ network interface method for networks of interest.
Here is a sample code for this:
namespace NetworkListSample { class TestNetworkEvents : INetworkListManagerEvents, INetworkConnectionEvents { private INetworkListManager m_nlm = new NetworkListManager(); private static Guid s_INetworkListManagerEventsGuid = typeof(INetworkListManagerEvents).GUID; private static Guid s_INetworkConnectionEventsGuid = typeof(INetworkConnectionEvents).GUID; public void RegisterForEvents() {
Please do not forget "unadvise", which accepts integer cookies as a parameter.
source share