Hello,
how are you?
You can help me? I'm working in a WINDOWS CE 3.0 project with Microsoft
Visual Studio C++ Embedded
3.0, and I'm using a WH_JOURNALRECORD Windows CE global hook.
I create the hook:
m_hHkJournalRec = m_pfSetWindowsJournalHook(WH_JOURNALRECORD,
JournalRecordProc, aInstance, 0);
m_pfSetWindowsJournalHook is a pointer to the QASetWindowsJournalHook
function, that's in the
coredll.dll library.
I have a JournalRecordProc process, and finally I want to delete the global
hook:
m_pfUnhookWindowsJournalHook(m_hHkJournalRec)
where m_pfUnhookWindowsJournalHook is a pointer to the
QAUnhookWindowsJournalHook function, that's in
the coredll.dll library.
And my problem, is that this function returns false, instead of true, and
that wants to say that
the global hook isn't deleted correctly, and the system resources are not
free. In addition, when
my application finishes in the Pocket PC, the PDA becomes blocked, and it
doesn't detect any other
keyboard or mouse event, and I have to do a software reset.
There is a function, called GetLastError(), that gives you the last error
that happens in the
system, but this function returns 0, that wants to say, "all is correct".
Someone can help me, and
knows how delete this global hook correctly?
HINSTANCE aInstance = GetModuleHandle(NULL); --> aInstance makes reference
to real module, not
to a dll, it's not necessary! (it can be also an EXE file);
What do you think about it?
Thanks,
Sincerely,
javitobcn (barcelona SPAIN).
You are not correctly call the function QASetWindowsJournalHook.
This is definition of this function:
HHOOK WINAPI QASetWindowsJournalHook(
int nFilterType,
HOOKPROC pfnFilterProc,
EVENTMSG *pfnEventMsg
);
BOOL WINAPI QAUnhookWindowsJournalHook(
int nFilterType
);
typedef struct tagEVENTMSG {
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG;
So call QASetWindowsJournalHook like this:
EVENTMSG evtMsg;
ZeroMemory(&evtMsg, sizeof(EVENTMSG));
HHOOK hh = pfSetWindowsHook(WH_JOURNALRECORD, JournalRecordProc, &evtMsg);
--
Best regards,
Vladimir Zinin
mailto:zi...@eldos.org