SetOpenSourceTimeout()

Description

Sets a time-out to call OpenSource() method. After the configured time-out, it will stop connecting to the currently selected Data Source.

It is used to check ErrorString property when OpenSource method fails after a specified number of milliseconds. This prevents the scan page from being unresponsive when the selected device is not connected.

Syntax

.SetOpenSourceTimeout(iMilliseconds);

Parameters

<int> iMilliseconds: specifies the number of milliseconds.

Return value

bool

true indicates success. false indicates failure.

When false is returned, check ErrorCode or ErrorString for error information.

Remarks

SetOpenSourceTimeout() should be called before OpenSource().

Example

DWObject.SelectSource();
DWObject.CloseSource();
DWObject.SetOpenSourceTimeout(3000); 
DWObject.OpenSource();
if (DWObject.ErrorCode == 0){ // OpenSource() succeeded
    DWObject.AcquireImage();
}
else{ // OpenSource() failed after 3000 milliseconds
    alert(DWObject.ErrorString);
}

See also

OpenSource