typedef struct HookEngineData_tag { KADMOS_ERROR (KADMOS_API *HookRecDoStart)(RecData *); KADMOS_ERROR (KADMOS_API *HookRecDoEnd)(RecData *); KADMOS_ERROR (KADMOS_API *HookRelDoStart)(RelData *); KADMOS_ERROR (KADMOS_API *HookRelDoEnd)(RelData *); KADMOS_ERROR (KADMOS_API *HookRepDoStart)(RepData *); KADMOS_ERROR (KADMOS_API *HookRepDoEnd)(RepData *); } HookEngineData;
The connection of a hook engine gives the possibility to call a specific function directly before or after the recognition
of a character, a text line, or a page. These functions must be provided in an external data structure. Additionally the
parameter general must be set to GENERAL_HOOKENGINE_ON
. It is possible to include these specified functions
directly into an application. Under Windows it is also possible to provide the functions as dll during runtime of the program.
The correspondend entries must have the names RecDoStart
, RecDoEnd
, RelDoStart
,
RelDoEnd
, RepDoStart
, or RepDoEnd
.
On every call of rec_init()
, rel_init()
, or rep_init()
KADMOS looks for a file
KadmosHook.dll
in several directories. The sequence of the search is:
- Directory specified by an environment variable KADMOSxx (xx describes the version number without a dot).
- Directory of the exe file.
- Current directory.
- Directory above the current directory.
- System directory.
- Windows directory.
When KadmosHook.dll
was found the entries (if exist) will be listed in a structure KadmosHookEngine
.
Else Kadmos looks with the following routine for an other provided dll:
if (!*dll_path) { HWND hWindow; unsigned short hAtom; hWindow = FindWindow("KADMOSHookActivate", NULL); if (hWindow) { Sleep (2000); hAtom = (unsigned short)SendMessage (hWindow, WM_USER, 1, 0); if (hAtom) { GlobalGetAtomName (hAtom, dll_path, sizeof(dll_path)); GlobalDeleteAtom (hAtom); } } if (*dll_path) { if (!HookDllVersionOk(dll_path)) *dll_path = '\0'; } }