GetVPNConnected function

The GetVPNConnected function launches the Get Connected wizard within the calling application to enable virtual private network (VPN) connectivity.

Syntax

HRESULT WINAPI GetVPNConnected(
  _In_     const HWND   hwndParent,
  _In_     const DWORD  dwWizardType,
  _In_     const DWORD  dwContextFlags,
  _In_     const DWORD  dwUserFlags,
  _In_     const HANDLE hUserContext,
  _In_opt_       LPWSTR pszCommandLine
);

Parameters

hwndParent [in]

Handle to the parent window that called this API.

This parameter is optional and can be set to NULL.

dwWizardType [in]

Specifies the style of the Get Connected wizard to be launched.

This parameter is optional and can be set to 0.

Value Meaning
0x00
Default style.

dwContextFlags [in]

A set of context flags that describes wizard behaviors.

This parameter is optional and can be set to 0.

Value Meaning
0x00
The wizard returns the results synchronously and blocks until this call is complete.
0x1
The wizard returns the results immediately and asynchronously via a Windows event.

dwUserFlags [in]

A set of user-defined application-specific flags. These flags are defined and interpreted by the calling application.

This parameter is optional and should be set to 0 by default.

hUserContext [in]

User context handle for the parent application thread.

This parameter is optional and should be set to NULL by default.

pszCommandLine [in, optional]

User command line parameters, if any.

This parameter is optional and can be set to NULL.

The following command-line options are supported:

Value Meaning
-HideFinishPage
Hide the Finish page of the Get Connected wizard.
-SkipInternetDetection
Do not display the Get Connected wizard page that shows whether or not the user has a working or active Internet connection.
-SkipExistingConnections
Do not display the Get Connected wizard page that shows a list of existing Internet connections. This command-line option is commonly used when creating additional Internet connections after one has been previously established, and to prevent novice users from creating a completely new connection each time they attempt to access the Internet.

Return value

If the method succeeds the return value is S_OK.

If the method fails, the return value is one of the standard error codes.

Remarks

This API attempts to connect the current user to a VPN. This process can involve creating a new connection, or repairing an existing one.

Note that while this API might indicate that the user is connected to a VPN, resources within that VPN may remain unavailable due to VPN configuration or infrastructure settings.

To launch a Get Connected wizard for an Internet connection, call the GetInternetConnected API.

To launch a Get Connected wizard for an local network (LAN) connection, call the GetNetworkConnected API.

An import library containing the GetVPNConnected function is not included in the Microsoft Windows Software Development Kit (SDK). Applications must use the GetModuleHandle and GetProcAddress functions to retrieve the function pointer from the corresponding DLL and call this function.

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
DLL
Connect.dll