永发信息网

C# 调用 WlanAPI的问题

答案:1  悬赏:70  手机版
解决时间 2021-04-28 19:10
  • 提问者网友:沦陷
  • 2021-04-28 11:21

  [DllImport("wlanapi.dll")]
        public static extern int WlanConnect(
            [In] IntPtr clientHandle,
            [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
            [In] ref WlanConnectionParameters connectionParameters,
            IntPtr pReserved);
           

想知道怎么可以调用成功

最佳答案
  • 五星知识达人网友:往事隔山水
  • 2021-04-28 12:01

 //断开网络
    public void Disconnect()
    {
    IntPtr _clientHandle = whc.WlanOpenHandle(1);
    NetworkInterface[] _interface = NetworkInterface.GetAllNetworkInterfaces();
    Guid netIfaceGuid = new Guid(_interface[0].Id);
    WlanDisconnect(_clientHandle, netIfaceGuid, IntPtr.Zero);
    whc.WlanCloseHandle(_clientHandle);


    }
    //断开网络
    public void Disconnect(NetworkInterface _interface)
    {
    IntPtr _clientHandle = whc.WlanOpenHandle(1);
    Guid netIfaceGuid = new Guid(_interface.Id);
    WlanDisconnect(_clientHandle, netIfaceGuid, IntPtr.Zero);
    whc.WlanCloseHandle(_clientHandle);


    }

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯