QASetWindowsJournalHook by managed code
- From: "Jack P" <private@xxxxxxxxxxxx>
- Date: Thu, 2 Apr 2009 12:47:08 +0800
Hi All,
I am trying QASetWindowsJournalHook() in c#, it works but having some problem.
I can receive the hooked message correctly ( mouse move, click, x , y ....etc ), but as long as I do something as below, the system (ppc) will crash.
1. Run my c# QASetWindowsJournalHook application, working.
2. Click [Start], my application is still working, message received well.
3. Click [Today] or [Setup] or [IE] ... whatever the next program is .... the while system will crash ( stop there then can't do anything .... )
public static int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)
{
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
I also tried to GCHandle everything but result is the same ...
public static void init_hook()
{
EVENTMSG myHookMessage = new EVENTMSG();
myHookMessage.message = 0;
myHookMessage.paramH = 0;
myHookMessage.time = 0;
GCHandle gc1 = GCHandle.Alloc(myHookMessage, GCHandleType.Pinned);
GCHandle gc2 = GCHandle.Alloc(MouseHookProcedure, GCHandleType.Pinned);
GCHandle gc3 = GCHandle.Alloc(hHook, GCHandleType.Pinned);
hHook = QASetWindowsJournalHook(0, MouseHookProcedure, ref myHookMessage);
}
and I also tried to package the hook functions into a c# DLL ...
but result is the same ... will also crash ...
Can somebody help ?
Appreciate!
JB
.
- Follow-Ups:
- Re: QASetWindowsJournalHook by managed code
- From: Chris Tacke, eMVP
- Re: QASetWindowsJournalHook by managed code
- Prev by Date: QASetWindowsJournalHook
- Next by Date: Re: How to create Bluetooth COM Port via programmatically
- Previous by thread: QASetWindowsJournalHook
- Next by thread: Re: QASetWindowsJournalHook by managed code
- Index(es):
Relevant Pages
|
Loading