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 Node
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; // specifies the capture interval.
GP. grabmode = xdictgrabmodeenum. xdictgrabmouse; // you can specify the attribute of a word.
GP. grabenabled = true; // whether the attribute of the word is used
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; // The statement where the cursor is located
// This. textbox1.text = sentencestring. substring (lloc +); // the character of the mouse
Return 1;
}
}
}
Download word.rar from the source code
B. nhw32.dll Method
This is a component written by C ++.
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 punctuation marks other, terminate the word extraction. 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/2000 nhw32.dll also introduces two other functions:
1. bool winapi setnhw32 ()
Function:
The initialization function in the Windows NT/2000 environment. GenerallyProgramIt is called once at the beginning.
Parameters:
None.
Return Value:
If success is true, failure is false.
2. bool winapi resetnhw32 ()
Function:
De-initialization function in Win NT/2000 environment. It is generally called at the end of a program.
Parameters:
None.
Return Value:
If success is true, failure is false.