🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10434

Re: How to catch mouseclicks from another application?

#10434
From: Henk
Date: Thu, 08 Apr 2004 12:20
52 lines
2358 bytes
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: <40754399$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <407421ef@newsgroups.borland.com> <40743aad$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 05:40:08 PST
From: "Henk" <h.van.winkoop@wxs.nl>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <407421ef@newsgroups.borland.com> <40743aad$1@newsgroups.borland.com>
Subject: Re: How to catch mouseclicks from another application?
Date: Thu, 8 Apr 2004 14:20:40 +0200
Lines: 54
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: <40754399$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081426841 62.131.145.60 (8 Apr 2004 05:20:41 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail