Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
3/26/2014
This function attempts to connect to a specific network.
Syntax
DWORD WINAPI WlanConnect(
__in HANDLE hClientHandle,
__in const GUID* pInterfaceGuid,
__in const PWLAN_CONNECTION_PARAMETERS pConnectionParameters,
__reserved PVOID pReserved
);
Parameters
- 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:
|
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. |
ERROR_ACCESS_DENIED |
One of the following occurred:
|
Remarks
If you include Connection Manager in your OS design:
- You must handle Wi-Fi connection operations using Connection Manager APIs such as CmAcquireConnection, CmAddConnectionConfig, or CmReleaseConnection.
- 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.
See Also
Reference
Native Wi-Fi Functions
WlanOpenHandle
WlanRegisterNotification
WLAN_CONNECTION_PARAMETERS
WlanDisconnect
Native Wi-Fi Reference