高手请赐教:利用能抓窗口文字软件提供的dll接口去捕获指定窗口中的文字?
本帖最后由 manlty 于 2010-3-19 20:01 编辑以下是摘录的该捕捉程序的帮助文件里的一段说明:
1.1. Creating a TextCaptureX object
First of all, the TCaptureX library must be registered on
the system. This can be done using the following command:
regsvr32 <path>\TCaptureX.dll
where <path> is the actual path to the TCaptureX library.
The registrations process is automaticallydone from the
setup.
Following are some examples on how to create a TextCaptureX
object in your application.Remark: before creating the object, CoInitialize API
function must be called.
1.1.2. C#
- add TCaptureX library to the list of the project
references
Optionally, you may add at the beginning of the file:
using TCaptureXLib;
in order to reference the objects without specifying
the namespace.
The actual creation is:
TextCaptureXClass obj = new TextCaptureXClass();
1.1.3. Visual Basic
- add TCaptureX library to the list of the project
references
The actual creation is:
Dim obj As New TextCaptureX
1.2. Using a TextCaptureX object
TextCaptureX object exposes the following methods:
- GetActiveWindowHwnd
- CaptureInteractive
- CaptureActiveWindow
- GetTextFromPoint
- GetTextFromRect 1.2.3. CaptureActiveWindow method
HRESULT CaptureActiveWindow( BSTR* result);
This method captures the text from the window that is currently active,
that is the window returned by the GetActiveWindowHwnd method. The
return value is the entire text from the active window.
Remark: The application where this method is called is responsible of
NOT containing the active window of the system.
Parameters:
BSTR* result : the text from the active window
Examples:
Visual C++:
_bstr_t result = obj->CaptureActiveWindow();
C#:
string result = obj.CaptureActiveWindow();
Visual Basic:
Dim result As String
result = obj.CaptureActiveWindow() 请高手写个示范程序,抓活动窗口里的文字 只有out,没有in? 楼上朋友,难道这个dll不是用来截取任意窗口里的文字的吗?
页:
[1]