using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace wifi { class Program { static void Main(string[] args) { wifi wf = new wifi(); wf.EnumerateAvailableNetwork(); } } class wifi { ///
/// 打开一个wifi句柄 /// ///
版本号 ///
保留 ///
支持的最高版本(输出) ///
句柄(要得到的)以后的句柄一般都是这个 ///
[DllImport("Wlanapi", EntryPoint = "WlanOpenHandle")] public static extern uint WlanOpenHandle(uint dwClientVersion, IntPtr pReserved, [Out] out uint pdwNegotiatedVersion, ref IntPtr ClientHandle); ///
/// 关闭打开的句柄 /// ///
句柄 ///
保留 ///
[DllImport("Wlanapi", EntryPoint = "WlanCloseHandle")] public static extern uint WlanCloseHandle([In] IntPtr hClientHandle, IntPtr pReserved); ///
/// 列举无线网络适配器 /// ///
句柄 ///
保留 ///
数据指针(非托管) ///
[DllImport("Wlanapi", EntryPoint = "WlanEnumInterfaces")] public static extern uint WlanEnumInterfaces([In] IntPtr hClientHandle, IntPtr pReserved, ref IntPtr ppInterfaceList); ///
/// 释放内存 /// ///
要释放的内存起始地址 [DllImport("Wlanapi", EntryPoint = "WlanFreeMemory")] public static extern void WlanFreeMemory([In] IntPtr pMemory); ///
/// 获得可见的无线网络 /// ///
句柄 ///
适配器的Guid号