Initialize Method

Initialize the component and load the networking library.

Syntax

object.Initialize([LicenseKey] [, ModuleName] [, Options] [, Reserved])

The Initialize method syntax has the following parts:

Part Description
object An object expression that evaluates to a FileTransfer object.
LicenseKey A string which specifies the runtime license key.
ModuleName A string which specifies the name of the network module.
Options A reserved argument; this argument is currently unused.
Reserved A reserved argument; this argument is currently unused.

Return Type

Integer

Remarks

The Initialize method explicitly loads and initializes the Windows Sockets networking library. Typically this is not required because it's done automatically when any control function is taken which requires network access, such as attempting a connection to a remote host.

The LicenseKey argument specifies a runtime license key used to initialize the control. Normally this argument is not needed, since the appropriate license key is used when an instance of the control is created. However, if an instance of the control is created using the CreateObject function, the Initialize method must be called with a valid runtime license key. If the license key is omitted or passed as an empty string, a development license must be installed on the local system.

The ModuleName argument is the full pathname of the Windows Sockets library loaded by the control. Setting the argument to the name of an appropriate library causes it to be loaded. If this argument is not specified, or an empty string is passed as the value, the default system Windows Sockets library is loaded.

The Options and Reserved arguments are unused and should not be specified.

A value of zero is returned if the control was initialized successfully. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Example

  '
  ' Create an instance of the FileTransfer object
  '
  Set objTransfer = WScript.CreateObject("SocketTools.FileTransfer.5")

  '
  ' Initialize the object, using the default Windows Sockets
  ' library and the specified runtime license key; if the key
  ' is not specified, the development license will be used
  '
  nError = objTransfer.Initialize(CSFTXCTL_LICENSE_KEY) 
  If nError <> 0 Then
      WScript.Echo "Unable to initialize the FileTransfer control"
      WScript.Quit(1)
  End If

See Also

Uninitialize Method


Copyright © 2008 Catalyst Development Corporation. All rights reserved.