hClientHandle
[in] Handle to the session on the client. To obtain a handle, call WlanOpenHandle.
pInterfaceGuid
[in] The GUID of the interface to use for the connection.
pConnectionParameters
[in] Pointer to a WLAN_CONNECTION_PARAMETERS structure that specifies the connection type, mode, network profile, SSID that identifies the network, and other parameters.
pReserved
Reserved; set to NULL.
Return Values
Value
Description
ERROR_SUCCESS
The function succeeds.
ERROR_INVALID_PARAMETER
One of the following conditions occurred:
hClientHandle is NULL or invalid.
pInterfaceGuid is NULL.
pConnectionParameters is NULL.
The dwFlags member of the structure pointed to by pConnectionParameters is not set to a value designated on the WLAN_CONNECTION_PARAMETERS page.
The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure, and the pDot11Ssid member of the same structure is NULL.
The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure, and the dot11BssType member of the same structure is set to dot11_BSS_type_any.
The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_profile, and the strProfile member of the same structure is NULL or the length of the profile exceeds WLAN_MAX_NAME_LENGTH.
The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_profile, and the strProfile member of the same structure is NULL or the length of the profile is zero.
The wlanConnectionMode member of the structure pointed to by pConnectionParameters is set to wlan_connection_mode_invalid.
The dot11BssType member of the structure pointed to by pConnectionParameters is set to dot11_BSS_type_infrastructure, and the dwFlags member of the same structure is set to WLAN_CONNECTION_ADHOC_JOIN_ONLY.
The dot11BssType member of the structure pointed to by pConnectionParameters is set to dot11_BSS_type_independent, and the dwFlags member of the same structure is set to WLAN_CONNECTION_HIDDEN_NETWORK.
The dwFlags member of the structure pointed to by pConnectionParameters is set to WLAN_CONNECTION_IGNORE_PRIVACY_BIT, and either the wlanConnectionMode member of the same structure is not set to wlan_connection_mode_temporary_profile or the dot11BssType member of the same structure is set to dot11_BSS_type_independent.
ERROR_INVALID_HANDLE
The handle hClientHandle was not found in the handle table.
RPC_STATUS
Can be any Remote Procedure Call (RPC) error code. The RPC call may be unsuccessful due to Wlan RPC server issues, such as when the RPC server is not started. Refer to RPC for more information.
Otherwise, if you use this API, it returns ERROR_ACCESS_DENIED.
The WlanConnect function returns immediately. If you want be notified when it establishes a connection, or when it will no longer attempt additional connections, you can register for notifications by calling WlanRegisterNotification.