🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

How to use SetWindowsHookEx?

#499
From: amol
Date: Wed, 19 Mar 2008 05:36
25 lines
1368 bytes
Hi there,

I am getting following error messages while using SetWindowsHookEx:

"cannot convert 'long (__stdcall *)(int,unsigned int,long)' 
to 'int(__stdcall *)()' "

"Type mismatch in parameter 'lpfn' (wanted 'int(__stdcall *)()', got 'long(__stdcall *) (int,unsigned int,long)')"


I am calling the "SetWindowsHookEx" as follow:

hook = SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,hinstance,NULL);
LRESULT CALLBACK KeyboardProc(int ncode,WPARAM wparam,LPARAM lparam)
{
  return ( CallNextHookEx(hook,ncode,wparam,lparam) );
}

As per the documentation "KeyboardProc" should take three parameters, but it is giving me error.
I am using C++ Builder 6.

Thanks,

Amol
Technical Details
Message-ID: <47e0a645$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
From: "amol" <kolekar.amol@gmail.com>
Sender: "amol" <kolekar.amol@gmail.com>
Reply-To: "amol" <kolekar.amol@gmail.com>
Subject: How to use SetWindowsHookEx?
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 203.115.114.34     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <47e0a645$1@newsgroups.borland.com>
Date: 18 Mar 2008 22:36:05 -0700
X-Trace: newsgroups.borland.com 1205904965 207.105.83.66 (18 Mar 2008 22:36:05 -0700)
Lines: 25
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail