System hook out of my aplication

How can i make a system hook to see what´s hapenig out of
my aplication???

I need some codes...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


What kind of hooks are you looking for?  Key hooks?  Mouse hooks?  WndProc hooks?
If you provide your e-mail address, I will mail you a sample using key hooks.

From your question, i suppose that you know how to make hook for your application.
So as the last parameters of the call to SetWindowsHookEx, don't put the thread handle but put 0 instead. The same hook as the one you did use for your application will become enable to all the system

kort77Author Commented:
I need hook for the peripherics of the PC (Mouse, Keys, etc.), Open and close aplications and other basic operations.
I need some codes to guide my developing...

Thanks for your time!!!

- -
to install the hook for the keyboard :
myhook:=setwindowshookex(wh_keyboard, @clavier_hook_msg, system.hInstance, 0);

where clavier_hook_msg is a callback procedure defined as follow :
function clavier_hook_msg(code: Integer; wparam: Word; lparam: Longint): longint;      stdcall;
  if (code<0) then
    result:=callnexthookex(clavier_crochet, Code, wparam, lparam)
    result:=0; {continue the message to other hook/windows <>0 stop the message}

wparam will containt the virtual key code of the pressed key and iparam some information about keyboard status

and finally to iuninstall the hook :


PS : if you want more information contact me at

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.