[To the original] http://tb.blog.csdn.net/TrackBack.aspx? Postid = 904807
A. Kingsoft Mac component method
In Kingsoft Mac 2005, an xdictgrb. dll is included to add references.
Put the source code on.
Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. text;
Using System. Windows. forms;
Using Xdictgrb; // Kingsoft Mac component
Namespace Windowsapplication1
{
Public Partial Class Form1: form, ixdictgrabsink
{
Public Form1 ()
{
Initializecomponent ();
}
Private Void Form1_load ( Object Sender, eventargs E)
{
Grabproxy GP = New Grabproxy ();
GP. grabinterval = 1 ; // The capture interval.
GP. grabmode = Xdictgrabmodeenum. xdictgrabmouse; // Set the attribute of the word extraction.
GP. grabenabled = True ; // Whether to take the word attribute
GP. advisegrab ( This );
}
// Interface implementation
Int Ixdictgrabsink. queryword ( String Wordstring, Int Lcursorx, Int Lcursory, String Sentencestring, Ref Int Lloc, Ref Int Lstart)
{
This . Textbox1.text = Sentencestring; // Mouse statement
// This. textbox1.text = sentencestring. substring (lloc + 1, 1 ); // Mouse character
Return 1 ;
}
}
}
B. nhw32.dll Method
This is C ++ Write a component
Nhw32.dll mainly introduces two functions:
1 . DWORD winapi bl_setflag32 (uint nflag,
Hwnd hpolicywnd,
Int Mousex,
Int Mousey)
Function:
Start or stop word extraction.
Parameters:
Nflag
[Input] specify one of the following values:
Getword_enable: start to get the word. Set this flag before the word area to be repainted. Nhw32.dll is passed through
Re-draw the word area and intercept textouta, textoutw, exttextouta,
Exttextoutw and other Windows API function parameters to take words.
Getword_disable: Stop word extraction.
Hpolicywnd
[Input] Notification Window handle. When this is obtained, send a registration message to the notification window: gwmsg_getwordok.
Mousex
[Input] The X coordinate of the word point.
Mousey
[Input] The Y coordinate of the word point.
Return Value:
Ignored.
2 . DWORD winapi bl_gettext32 (lpstr lpszcurword,
Int Nbuffersize,
Lprect lpwordrect)
Function:
Extracts word text strings from the internal buffer. For English text, this function can take up to three English word strings bounded by spaces in a row. In case of spaces, non-English letters and division' - . For Chinese characters, this function can take up to one line of Chinese characters. In case of English letters, punctuation marks, and other non-Chinese characters, the function terminates the process of taking words. This function cannot take English and Chinese characters at the same time.
Parameters:
Lpszcurword
[Input] Destination buffer pointer.
Nbuffersize
[Input] target buffer size.
Lpwordrect
[Output] pointer to the rect structure. This structure defines the area of the rectangle where the word is taken.
Return Value:
The position of the current cursor in all words.
In addition, winnt / Version 2000 nhw32.dll also introduces two other functions:
1 . Bool winapi setnhw32 ()
Function:
Win NT / 2000 Environment initialization function. GenerallyProgramIt is called once at the beginning.
Parameters:
None.
Return Value:
If success is true, failure is false.
2 . Bool winapi resetnhw32 ()
Function:
Win NT / 2000 deinitialize functions in the environment. It is generally called at the end of a program.
parameter:
none.
return value:
If the operation succeeds, the return value is false if the operation fails.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service