Groups | Search | Server Info | Login | Register


Groups > comp.os.ms-windows.programmer.memory > #4

Re: Global hook giving memory error

Newsgroups comp.os.ms-windows.programmer.memory
Date 2013-03-15 08:55 -0700
References <DdiVc.82$os2.78@read3.inet.fi>
Message-ID <87fd96d6-0b9c-48ec-a7e6-82fa86c2001f@googlegroups.com> (permalink)
Subject Re: Global hook giving memory error
From Google.Account@email.com

Show all headers | View raw


On Friday, August 20, 2004 3:01:39 AM UTC-5, -h- wrote:
> Hi.
> 
> I have a following problem.
> 
> I have installed a mouse hook for a application opened by my app. Lets say,
> for WinAmp. When WinAmp receives any mouse events, a memory error occurs
> (The instruction at "0x..." referenced memory at "0x....". The memory could
> not be "written").
> 
> I have my hooks set in a dll file like "SetWindowsHookEx(WH_MOUSE,MouseProc,
> hInstance,processThreadId);". The hInstance is received GetWindowInstance
> and processThreadId by GetWindowThreadProcessId. The WinAmp window handle is
> used for both.
> 
> I think this problem is in my dll file. It seems like the dll is trying to
> write something to a place where it is not allowed. The hooking works for my
> application window, but the hooking the opened applications will crash.
> 
> Any ideas? Thanks.
> 
> -h-

The hInstance should be the hInstance of the DLL. Don't set the hook from your application, but from a procedure in your DLL and use the hInstance of the DLL, that is how to inject DLL into foreign process.

Back to comp.os.ms-windows.programmer.memory | Previous | Next | Find similar


Thread

Re: Global hook giving memory error Google.Account@email.com - 2013-03-15 08:55 -0700

csiph-web