コード例 #1
0
        /// <summary>
        /// Requests a connection (association) to the specified wireless network.
        /// </summary>
        /// <remarks>
        /// The method returns immediately. Progress is reported through the <see cref="WlanNotification"/> event.
        /// </remarks>
        public void Connect(WlanConnectionMode connectionMode, Dot11BssType bssType, string profile)
        {
            WlanConnectionParameters connectionParams = new WlanConnectionParameters();

            connectionParams.wlanConnectionMode = connectionMode;
            connectionParams.profile            = profile;
            connectionParams.dot11BssType       = bssType;
            connectionParams.flags = 0;
            Connect(connectionParams);
        }
コード例 #2
0
        /// <summary>
        /// Connects to the specified wireless network.
        /// </summary>
        /// <remarks>
        /// The method returns immediately. Progress is reported through the <see cref="WlanNotification"/> event.
        /// </remarks>
        public void Connect(WlanConnectionMode connectionMode, Dot11BssType bssType, Dot11Ssid ssid, WlanConnectionFlags flags)
        {
            WlanConnectionParameters connectionParams = new WlanConnectionParameters();

            connectionParams.wlanConnectionMode = connectionMode;
            connectionParams.dot11SsidPtr       = Marshal.AllocHGlobal(Marshal.SizeOf(ssid));
            Marshal.StructureToPtr(ssid, connectionParams.dot11SsidPtr, false);
            connectionParams.dot11BssType = bssType;
            connectionParams.flags        = flags;

            Connect(connectionParams);

            Marshal.DestroyStructure(connectionParams.dot11SsidPtr, ssid.GetType());
            Marshal.FreeHGlobal(connectionParams.dot11SsidPtr);
        }
コード例 #3
0
 /// <summary>
 /// Connects to a network defined by a connection parameters structure.
 /// </summary>
 /// <param name="connectionParams">The connection paramters.</param>
 protected void Connect(WlanConnectionParameters connectionParams)
 {
     WlanInterop.ThrowIfError(WlanInterop.WlanConnect(client.clientHandle, info.interfaceGuid, ref connectionParams, IntPtr.Zero));
 }
コード例 #4
0
ファイル: Interop.cs プロジェクト: ProjectAgri20/newrepo
 public static extern int WlanConnect(
     [In] IntPtr clientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In] ref WlanConnectionParameters connectionParameters,
     IntPtr pReserved);