|
1.
Start a
new project in Visual Basic. Form1 is created by default.
|
|
2.
Add two TextBox,
one Label, one CommandButton . |
|
3.
Copy the
following code into the Form's module: |
| |
' Declare Text Capture library COM server object
Dim TcServer As TextCaptureLib.CTextCapture
Dim TcWindow As TextCaptureLib.CInputWindow
Private Sub Form_Load()
' Create Text Capture library COM server object
Set TcServer = CreateObject("TextCaptureLib.TextCapture")
Set TcWindow = CreateObject("TextCaptureLib.Window")
'Please set your license info
'
'If TcServer.License("skesoft", "123456789") Then
' 'The registered version of Text Capture Library
'Else
' 'The trial version of Text Capture Library
'End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set TcServer = Nothing
Set TcWindow = Nothing
End Sub
Private Sub GetTextBtn_Click()
Dim str As String
str = ""
TcWindow.Handle = Val(HwndText.Text)
' If you know the window control type,
' You can specify the windowtype directly here
' Otherwise just comment the following line
TcWindow.WindowType = WINDOWTYPE_AUTO
str = TcServer.GetText(TcWindow)
OutputText.Text = str
End Sub
|
|
4.
Press "F5" to run the application, input the window handle to be
captured, then click "Capture it!" button. |