| <= previous | ^ top | next => |
ecp_lnk.dll is an ActiveX DLL which provides a wrapper and an object model for SFWLink (sfwlnk32.dll).
This provides several enhancements to SFWLink.
ecp_lnk.dll provides a object model to simplify scanning calls.
As an ActiveX Server it can be called from any ActiveX Client including VB, MS Office, Pythonwin, ActivePerl, VC++, Java, etc.
The ecp_lnk.dll runs in its own memory space, and each instance runs in its own thread.
This will stabilize the scanning process as a DDE error in scanning will not bring down a client application.
It doesn't matter where ecp_lnk.dll is which is not the case for sfwlnk32.dll. It can sometimes be tricky getting ecp_lnk.dll to find sfwlnk32.dll. It depends upon the ultimate client app (and what runtime libraries are being used) as to where it will look. Places to put sfwlnk32.dll (and multiple copies don't seem to be a problem, even NCS software like MicrotestQ uses multiples) include
>>> import win32com.client # Import Client Components
>>> x = win32com.client.Dispatch(r'ecp_lnk.SingleScan') # Set x = to Object Instance
>>> y = x.Scan('001') # Call Scan of Single Form
>>> print y
'_SCANNED_DATA_IS_RETURNED_'
Dim s_Obj as New ecp_lnk.SingleScan 'Add this to the general declarations of your Form.
Private Function ScanOneForm(ByVal strForm As Sring) as String
ScanOneForm = s_Obj.Scan(strForm) 'If an error occurs, the error will be returned instead of the scanned data.
End Function
Private Sub Command1_Click()
Text1.Text = ScanOneForm("701")
End Sub
>>> # ecp_lnk.dll specific code is ORANGE
>>> import win32com.client # Import Client Components
>>> x = win32com.client.Dispatch(r'ecp_lnk.Engine') # Set x = to Scanning Engine Object Instance
>>> x.SFWPath('C:\\SFW') # Sets Path to ScanTools [Optional]
>>> err = x.ecpLoad # Loads ScanTools [LoadSFW()]
>>> err = x.ecpSetUp('701', '000001', '001', '1', 'N', 'M', 'N', '1', '', '', '')
>>> # The parameters in ecpSetUp mirror the SetUpSFW Parameters. If they are blank defaults (shown) are used.
>>> err = x.ecpScan('Start') # Starts Scanning Process
>>> while 1: # Loops Scanner
... if err == 2: # COMPLETE point
... err = x.ecpScan('Continue') # Returns sfwlnk32.dll error code. See NCS Documentation for details
... if err in [1, 0]: # XPRINT point
... err = x.ecpScan('Continue')
... z = x.ecpData # Returns current data string [can only be called after .ecpScan('X')]
... print z # Scanned data is printed
... else: # Reached when Scanner returns "Done" signal
... x.ecpScan('Done') # Closes SFW DDE
... break
... else: # Scanning process is over (or didn't begin).
... x.ecpClose
... print x.ScanPoint # Returns Scanner Diagnostic Information
Dim s_Obj as New ecp_lnk.Engine 'Add this to the general declarations of your Form.
Private Function LoopScanForms(ByVal strForm As Sring) as String
Dim ecpErr as Integer
'Load ScanTools
s_Obj.ecpLoad
'Call SetUpSFW() [These are the default values. If no values are entered these will be.
'to override them insert other strings.]
s_Obj.ecpSetUp("701", "000001", "001", "1", "N", "M", "N", "1", "", "", "")
ecpErr = s_Obj.ecpScan("Start")
Do While ecpErr <> 102
Select Case ecpErr
Case 1
ecpErr = s_Obj.ecpScan("Continue")
Case 2
ecpErr = s_Obj.ecpScan("Continue")
Call ParseData(s_Obj.ecpData())
Case Else
ecpErr = s_Obl.ecpScan("Done")
End Select
Loop
End Function
Private Sub ParseData(ByVal DATA as String)
'Do something with the scanner data contained in DATA variable.
End Sub
Private Sub Command1_Click()
Call LoopScanForms("701")
End Sub
ecp_lnk_source.zip (VB6SP3 Source) (5KB)
| <= previous | ^ top | next => |