zHelp crashes when F1 is pressed twice

Article ID: 872
Last updated: 05 Feb, 2008
Article ID: 872
Last updated: 05 Feb, 2008
Revision: 1
Views: 2796
Posted: 29 Oct, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


zHelp gives a General Protection Failure when F1 is pressed twice.



Action


Change the following code in the enablekey function in the source (helpapi.cpp) and recompile the library.

void zHelp::enableHelpKey(int enable) {
if (enable) {
if (!helpKeyEnabled) {
zHelp::_ziHelpKeyHelpObj=this;
lpfnFilterProc = (HOOKPROC) MakeProcInstance(

(FARPROC)helpKeyFilterFunction,zAppGetAppVar(app)->instance());
#ifndef __NT__
hook = SetWindowsHookEx(WH_KEYBOARD,
lpfnFilterProc,zAppGetAppVar(app)->instance(),
(HTASK)GetCurrentTask());
#else
DWORD CurThreadId = GetCurrentThreadId();
hook = SetWindowsHookEx(WH_KEYBOARD,
lpfnFilterProc,NULL,CurThreadId);
#endif
helpKeyEnabled = 1;
}
} else {
if (helpKeyEnabled) {
if (zHelp::_ziHelpKeyHelpObj==this)
zHelp::_ziHelpKeyHelpObj=0;
UnhookWindowsHookEx(hook);
FreeProcInstance((FARPROC)lpfnFilterProc);
helpKeyEnabled = 0;
}
}
}
This article was:   Helpful | Not helpful
Report an issue
Article ID: 872
Last updated: 05 Feb, 2008
Revision: 1
Views: 2796
Posted: 29 Oct, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category