↑  ←  Описание функции


_WinNet_UseConnection

Connects a local device to a network resource

#include <WinNet.au3>
_WinNet_UseConnection($hWnd, $sLocalName, $sRemoteName [, $sUserName = 0 [, $sPassword = 0 [, $iType = 1 [, $iOptions = 1]]]])

Параметры

$hWnd Handle to a window that the provider of network resources can use as an owner window for
    dialogs. Use this parameter if you set bit 2 (interactive) in the Options parameter. This parameter can be 0.
$sLocalName Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a
    case-insensitive manner. If 0, a connection to the network resource is made without redirecting the local
    device.
$sRemoteName Name of the network resource to connect to
$sUsername [необязательный] User name for making the connection. If 0, the function uses the default user name.
$sPassword [необязательный] Password to be used to make a connection. If 0, the default password is used. If the string is
    empty, no password is used.
$iType [необязательный] Specifies the type of network resource to connect to:
    0 - Any (only if $sLocalName is blank)
    1 - Disk
    2 - Print
$iOptions [необязательный] Connection options. Can be one or more of the following:
    1 - The network resource connection should be remembered
    2 - The operating system may interact with the user for authentication purposes
    4 - The system does not use any default setting for user names or passwords without offering the user the
    opportunity to supply an alternative. This flag is ignored unless bit 2 (interactive) is also set.
    8 - Forces the redirection of a local device when making the connection
    16 - The operating system prompts the user for authentication using the command line instead of a GUI. This
    flag is ignored unless bit 2 (interactive) is also set.
    32 - If this bit is set, and the operating system prompts for a credential, the credential is saved by the
    credential manager. If the credential manager is disabled for the caller's logon session, or if the network
    provider does not support saving credentials, this flag is ignored. This flag is also ignored unless you set
    bit 5 (command line instead of GUI).

Возвращаемое значение

Успех:Возвращает массив следующего формата:
$aInfo[0] - If True, the connection was made using a local device redirection
$aInfo[1] - If sLocalName specifies a local device, this is the local device name. If sLocalName does not
specify a device and the network requires a local device redirection, or if bit 4 (force redirection) is set,this buffer receives the name of the redirected local device. Otherwise, the name copied into the buffer isthat of a remote resource.
Ошибка:Устанавливает @error

См. также

Искать WNetUseConnection в библиотеке MSDN