Article View: borland.public.cppbuilder.nativeapi
Article #12681Re: Inserting keyboard characters
From: Remy Lebeau (TeamB)
Date: Thu, 20 Nov 2003 19:34
Date: Thu, 20 Nov 2003 19:34
32 lines
2267 bytes
2267 bytes
"Feico" <feicorem0veth1s@gmx.net> wrote in message
news:d62qrvgp18jgsvobn5pnb8m9knq85us5lf@4ax.com...
> Like this:
You cannot inject keystrokes with a hook. What you can do, however, is post
new keystroke messages to the target window using PostMessage() or
SendMessage() (not sure how well SendMessage() will work from inside a hook,
though).
> hook=GetProcAddress(hm,"@InstallKeyboardHook$qv");
> unhook=GetProcAddress(hm,"@UninstallKeyboardHook$qv");
Just a suggestion, I would suggest you declare your exported functions with
extern "C" and __stdcall, then they won't be mangled like like, ie:
extern "C" __declspec(dllexport) void __stdcall InstallKeyboardHook()
extern "C" __declspec(dllexport) void __stdcall UninstallKeyboardHook()
Then you can do this when calling GetProcAddress():
hook = GetProcAddress(hm, "InstallKeyboardHook");
unhook = GetProcAddress(hm, "UninstallKeyboardHook");
> I hope this is sufficient. I have attempted to modify the
> fields in lParam before I called CallNextHookEx
Hooks are not allowed to modify the data, only to look at it.
Gambit
Technical Details
Message-ID:
<3fbd1652$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!elnk-pas-nf1!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<2ucprvo1h1d0k0qehk76uvagkp1c0pt2cd@4ax.com> <3fbd02ad@newsgroups.borland.com> <d62qrvgp18jgsvobn5pnb8m9knq85us5lf@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5c9655efe3ac4e1b X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-20 11:40:51 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <2ucprvo1h1d0k0qehk76uvagkp1c0pt2cd@4ax.com> <3fbd02ad@newsgroups.borland.com> <d62qrvgp18jgsvobn5pnb8m9knq85us5lf@4ax.com> Subject: Re: Inserting keyboard characters Date: Thu, 20 Nov 2003 11:34:15 -0800 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.137.149 Message-ID: <3fbd1652$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1069356626 67.22.137.149 (20 Nov 2003 11:30:26 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!elnk-pas-nf1!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail