Article View: borland.public.cppbuilder.nativeapi
Article #10438Re: How to catch mouseclicks from another application?
From: Henk
Date: Thu, 08 Apr 2004 14:24
Date: Thu, 08 Apr 2004 14:24
67 lines
2795 bytes
2795 bytes
uuuhhh....I was too quick, I found the sollution on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
/WindowsUserInterface/Windowing/Hooks/UsingHooks.asp
Thanks
"Henk" <h.van.winkoop@wxs.nl> schreef in bericht
news:40754399$1@newsgroups.borland.com...
> Thanks, Gambit, I had no idea how to approach this issue.
>
> I managed to create my first dll(!) (took me 4 hours) but how to pass a
> MouseProc to SetWindowsHookEx?
>
> //My mouseproc definition
> LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
> {
> //my mouse stuff
> }
>
> //My dll hook-the-mouse function definition
> void __export MyDllHookTheMouseFunction(void)
> {
> HHOOK MyHook =
> SetWindowsHookEx(WH_MOUSE,MouseProc,MyInstance,MyThreadId);
> }
>
> I keep getting this compile error: Type mismatch in parameter 'lpfn'
> Cannot convert 'long(__stdcall*)(int,unsigned int,long)' to
> 'int(__stdcall*)()'
> More readable: Cannot convert A to B.
>
> I understand that MouseProc is of kind A and SetWindowsHookEx 'lpfn'
expects
> type B.
>
> So how to pass a type A (LRESULT CALLBACK) into type B (HOOKPROC)?
>
> (I read Borland books and checked Internet, but could not find, I believe
> I'm thinking the wrong direction)
>
> greetings,
>
> Henk
>
>
>
> "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> schreef in
> bericht news:40743aad$1@newsgroups.borland.com...
> >
> > "Henk" <h.van.winkoop@wxs.nl> wrote in message
> > news:407421ef@newsgroups.borland.com...
> >
> > > I just want to catch mouse clicks being clicked on another
application.
> >
> > You need to install a mouse hook for that. Look at the
SetWindowsHookEx()
> > function. You need to implement it inside a DLL.
> >
> >
> > Gambit
> >
> >
>
>
Technical Details
Message-ID:
<407560a8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<407421ef@newsgroups.borland.com> <40743aad$1@newsgroups.borland.com> <40754399$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,e0858ea1c0821ca X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-08 07:40:48 PST From: "Henk" <h.van.winkoop@wxs.nl> Newsgroups: borland.public.cppbuilder.nativeapi References: <407421ef@newsgroups.borland.com> <40743aad$1@newsgroups.borland.com> <40754399$1@newsgroups.borland.com> Subject: Re: How to catch mouseclicks from another application? Date: Thu, 8 Apr 2004 16:24:39 +0200 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 NNTP-Posting-Host: 62.131.145.60 Message-ID: <407560a8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1081434280 62.131.145.60 (8 Apr 2004 07:24:40 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail