GetWord 3.3, getword3.3
1. Origin
To develop a cheating software, you need to take down the questions on the screen.
It is said that it is difficult to get words for IE, so it dispelled the idea of self-development, find a useful control.
Two usable files are found. One is the XdictGrb. dll file of Kingsoft, and the other is the GetWord File above.
1.1 Kingsoft Mac XdictGrb. dll
Here is an example of C.
The example of C # seems to be unstable. After a few words are taken, it cannot be obtained and I don't know where it is.
In addition, C # has encountered difficulties in converting to Python, mainly because it is not familiar with the mutual calls between COM and Python and will be solved later.
1.2 GetWord 3.3
GetWord 3.3 comes with an example of VB \ VC \ C # \ Delphi.
Let's take a look at the following principle: first, you need to create a form by yourself. A message is sent to this window as a notification every time the control word is successfully obtained. The form can be further processed after receiving the message.
1.3 GetWord official edition
Here is the official website http://www.textcapture.com /.
The official website version is relatively high, and the interface changes a lot. It seems that the call is more convenient than before. You don't have to implement a window like 3.3 to receive messages, just register a callback function. Unfortunately, I did not find an official example. I tried it according to the help document and gave up if I didn't succeed. 3.3 is also useful.
2. Python and GetWord 3.3
GetWord 3.3 can be called either as an ActiveX control or by directly calling functions in a DLL. Or DLL method is relatively simple.
The following code is transferred from C #. Because there is no document, some functions do not understand what it means.
Import win32con, win32gui, win32apiimport ctypesclass MyWindow (): def _ init _ (self): self. getword_loaded = False # register a window class wc = win32gui. WNDCLASS () wc. lpszClassName = 'mywindow' wc. hbrBackground = win32con. COLOR_BTNFACE + 1 wc. lpfnWndProc = self. wndProc class_atom = win32gui. registerClass (wc) # create window self. hwnd = win32gui. createWindow (class_atom, u'window title', win32con. WS_OVERLAPPEDWINDOW, win32con. CW_USEDEFAULT, win32con. CW_USEDEFAULT, 200,100, 0, 0, None) # display window win32gui. showWindow (self. hwnd, win32con. SW_SHOWNORMAL) self. _ init_getword () def _ init_getword (self): LICENSEID = "{00000000-0000-0000-0000-000000000000}" MOUSEHOOK_CAPTURE_ OK _MSG = "MOUSEHOOK_CAPTUREOK_MSG-" + LICENSEID self. MOUSEHOOK_CAPTURE_ OK = win32gui. registerWindowMessage (MOUSEHOOK_CAPTURE_ OK _MSG) self. icall = ctypes. windll. loadLibrary ('icall') self. icall. setMouseHook (self. hwnd) self. icall. mouseEnableCap (True) self. icall. getWordEnableCap (True) self. getword_loaded = True def _ del_getword (self): self. getword_loaded = False self. icall. removeMouseHook () hdll = win32api. getModuleHandle ('icall. dll ') win32api. freeLibrary (hdll) def _ capture_text (self): max_output_len= 1024
X, y = win32gui. getCursorPos () hrwnd = self. icall. getRealWindow (x, y) strtmp = ctypes. create_unicode_buffer ('\ 0' * MAX_OUTPUT_LEN) I = ctypes. c_int (-1) OK = self. icall. getWord (hrwnd, x, y, strtmp, MAX_OUTPUT_LEN, ctypes. byref (I) if OK: print U' all text: % s' % strtmp. value print u'word location: % s' % I. value # Message Processing def wndProc (self, hwnd, msg, wParam, lParam): if self. getword_loaded and msg = self. MOUSEHOOK_CAPTURE_ OK: print 'mousehook _ CAPTURE_ OK 'self. _ capture_text () if msg = win32con. WM_CLOSE: print 'wm _ close' self. _ del_getword () if msg = win32con. WM_DESTROY: print 'wm _ DESTROY 'win32gui. postQuitMessage (0) return win32gui. defWindowProc (hwnd, msg, wParam, lParam) mw = MyWindow () win32gui. pumpMessages ()
Professional screen word retrieval engine-GetWord
What do you want to ask?
High decomposition: How can I achieve screen-based word Extraction in Kingsoft?
Messagebox (0, 'loading dynamic link library failed', 'Warning ', mb_ OK or mb_iconwarning or mb_applmodal );
Result: = FALSE; exit; end;
@ BL_SetFlag32: = GetProcAddress (g_hGetWordInst, 'bl _ setflag32 ');
If @ BL_SetFlag32 = nil then begin
Messagebox (0, 'loading screen keyword dynamic link library function: BL_SetFlag32 failed! ', 'Info', MB_ OK or MB_APPLMODAL or MB_ICONWARNING );
Result: = false; exit; end;
@ BL_GetText32: = GetProcAddress (g_hGetWordInst, 'bl _ GetText32 ');
If @ BL_GetText32 = nil then begin
Messagebox (0, 'loading screen keyword dynamic link library function: BL_GetText32 failed! ', 'Info', MB_ OK or MB_APPLMODAL or MB_ICONWARNING );
Result: = false; exit; end;
@ SetNHW32: = GetProcAddress (g_hGetWordInst, 'setnhw32 ');
If @ SetNHW32 = nil then begin
Messagebox (0, 'loading screen keyword dynamic link library function: SetNHW32 failed! ', 'Info', MB_ OK or MB_APPLMODAL or MB_ICONWARNING );
Result: = false; exit; end;
@ ResetNHW32: = GetProcAddress (g_hGetWordInst, 'resetnhw32 ');
If @ ResetNHW32 = nil then begin
Messagebox (0, 'loading screen words dynamic link library function: ResetNHW32 failed! ', 'Info', MB_ OK or MB_APPLMODAL or MB_ICONWARNING );
Result: = false; exit; end;
If SetNHW32 () = false then begin
Messagebox (0, 'cannot set the screen to take words! ', 'Info', MB_ OK or MB_APPLMODAL or MB_ICONWARNING );