好的,我正在尝试使用NetworkListManager
System.Runtime.InteropServices.ComTypes
使用此代码设置网络连接事件:
private NetworkListManager nlm; //This is initialized before
private IConnectionPoint icp;
private int cookie = 0;
//This part is wrapped in a function call
Console.WriteLine("Subscribing the INetworkListManagerEvents");
IConnectionPointContainer icpc = (IConnectionPointContainer)nlm;
Guid tempGuid = typeof(INetworkListManagerEvents).GUID;
icpc.FindConnectionPoint(ref tempGuid, out icp);
//The error is thrown in icp.Advise with code 0x80040202
icp.Advise(this, out cookie);
我已经尝试过搜索,但是大多数人都关注此错误的不同问题
答案 0 :(得分:0)
使用df$y <- str_detect(x, "<")
的正确方法是这样的:
NETWORKLIST
我做错了是我忘了实施using NETWORKLIST;
public class Foo : INetworkListManagerEvents
{
private NetworkListManager nlm;
private IConnectionPoint icp;
private int cookie = 0;
public Foo()
{
nlm = new NetworkListManager();
IConnectionPointContainer icpc = (IConnectionPointContainer)nlm;
Guid tempGuid = typeof(INetworkListManagerEvents).GUID;
icpc.FindConnectionPoint(ref tempGuid, out icp);
icp.Advise(this, out cookie);
}
//this method must be implemented
public void ConnectivityChanged(NLM_CONNECTIVITY newConnectivity)
{
//Your code goes here
}
}