Article View: borland.public.cppbuilder.nativeapi
Article #2995Re: Establishing a Keyboard Hook.........
From: Remy Lebeau (TeamB)
Date: Tue, 05 Sep 2006 02:16
Date: Tue, 05 Sep 2006 02:16
35 lines
2249 bytes
2249 bytes
"qyte" <gyte@vivodinet.gr> wrote in message news:44fc9f3a@newsgroups.borland.com... > I have built the following DLL... You are trying to use a global hook. Your DLL is going to be injected into every running process, and thus each process is going to be running its own copy of the DLL's variables. Each process is going to have its own copy of your HHOOK and HWND variables, but only the process that originally installs the hook will have accurate values for them. So you need to store your variables into a block of shared memory so that every process has equal access to those values. Otherwise your hook will not work correctly. Use CreateFileMapping() and MapViewOfFile() to set asside the block of shared memory. Please go to http://www.deja.com and search through the newsgroup archives. I have posted sample code on this topic many times before. > Why is this not working? Because you did not set up the DLL so that all of the other processes can access the HHOOK and HWND values that the DLL uses. > It only captures keystrokes from within my application... Because only your application has access to the correct HHOOK and HWND variable values. > I Want a system-wide hook... Then you must store the HHOOK and HWND values into shared memory. Gambit
Technical Details
Message-ID:
<44fdc1e3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44fc9f3a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,25dce3f6aa4fede9 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <44fc9f3a@newsgroups.borland.com> Subject: Re: Establishing a Keyboard Hook......... Date: Mon, 4 Sep 2006 19:16:25 -0700 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 68.69.17.41 Message-ID: <44fdc1e3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157480931 68.69.17.41 (5 Sep 2006 11:28:51 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail