public WlanHostedNetwork() { uint version; NativeMethods.WlanOpenHandle((uint)WlanAPIClientVersion.VISTA, IntPtr.Zero, out version, ref _clientHandle); NativeMethods.WlanHostedNetworkInitSettings(_clientHandle, out _reason, IntPtr.Zero); if (_reason == WlanHostedNetworkReason.Success) { SetWlanHostedNetworkInfo(); _wlanNotificationEventHandler = new WlanNotificationEventHandler(HandleNotificationEvent); WlanNotificationSource notificationSource; NativeMethods.WlanRegisterNotification(_clientHandle, WlanNotificationSource.All, true, _wlanNotificationEventHandler, IntPtr.Zero, IntPtr.Zero, out notificationSource); } else { NativeMethods.WlanCloseHandle(_clientHandle, IntPtr.Zero); } }
internal static extern uint WlanRegisterNotification(IntPtr hClientHandle, WlanNotificationSource dwNotifSource, bool bIgnoreDuplicate, WlanNotificationEventHandler funcCallback, IntPtr pCallbackContext, IntPtr pReserved, [Out] out WlanNotificationSource pdwPrevNotifSource);