SetOpenSourceTimeout()

Description

Sets the time-out used to open a specified Data Source.

Sometimes, it takes time for a Data Source to be opened. If the source fails to be opened, the method OpenSource might take a very long time to respond and freeze up the scan page. This method is added to handle this situation.

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, the source might be disconnected
    alert(DWObject.ErrorString);
}

See also

OpenSource

Is this page helpful?

Leave a Reply

Your email address will not be published.