次の方法で共有


AutoDialStartConnection (Compact 2013)

3/26/2014

This function initiates an Auto dial connection.

Syntax

DWORD AutoDialStartConnection(
  TCHAR* szUseDialEntry
);

Parameters

  • szUseDialEntry
    [in] Pointer to the name of the phonebook entry to use when making the connection. If this is NULL, then the connection is made by using the default connection that is configured in the registry.

Return Value

If no error occurs, this function returns a value of ERROR_SUCCESS.

The following table shows the return values if an error occurs.

Error value

Description

ERROR_DIAL_ALREADY_IN_PROGRESS

Another thread has either already initiated an Auto dial connection or is in the process of establishing a connection.

ERROR_RASAUTO_CANNOT_INITIALIZE

The registry key is not present or no RAS entry name is specified in the registry.

Remarks

This function determines the number to dial by using the szUseDialEntry parameter. If that parameter is null, this function loads the default auto dial connectoid from the RasEntryName1 value from the registry. This function then ensures specific conditions are met so that a connection can be made. Because it accesses global settings, and because only one connection is supported at a time, this function is designed to be run by one thread at a time.

The following list shows the conditions that must be met before this function attempts to create a connection:

  • The required registry key is valid.
  • Auto dial has been enabled.
  • This function has not failed three consecutive times within the time span that is equal to the FailRetryWaitMS value in the registry.

If these condition are met, this function calls RasDial, using the specified or default RAS connectoid. If the default connectoid is used and the first connection attempt fails, an attempt is made on the second connectoid, that is specified in the RasEntryName2 registry value. These are repeated the number of times that is equal to the RedialAttempts value in the registry before failing. If this fails, the RAS error code is returned to the function that called AutoDialStartConnection. If this succeeds, Auto dial updates its global settings and starts a timer thread.

The connection created with auto dial is closed if no activity has occurred within the time span that is equal to the IdleTimeoutMS value in the registry.

If these conditions are not met, this function returns an error to the calling function.

Requirements

Header

autodial.h

Library

Autodial.lib

See Also

Reference

ICS Functions
Internet Connection Sharing Auto Dial Registry Settings