共用方式為


GetInternetConnected function

The GetInternetConnected function launches the Get Connected wizard within the calling application to enable Internet connectivity.

Syntax

HRESULT WINAPI GetInternetConnected(
  _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 create new connections from existing or new media types, or alternatively running diagnostics to correct any problems found on existing connections.

Note that while this API might indicate that the user is connected to the Internet, a specified Internet address can remain unreachable.

To launch a Get Connected wizard for a VPN connection, call the GetVPNConnected API.

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

An import library containing the GetInternetConnected 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