Windows Hook WNDPROC

Posted on 2008-11-11
Medium Priority
Last Modified: 2012-05-05
Hi and sorry for my bad english,
i need to Hook a single form of a process (.exe) and i need to get all windows messages.

I've tyred to wirte a function so that:

    if FHWND <> 0 then begin
      LPID := GetWindowPID(FHWND);
      LProcess := OpenProcess(PROCESS_CREATE_THREAD +
      if LPID <> 0 then begin
        KBHook := SetWindowsHookEx(WH_CALLWNDPROC, @HookProc, LProcess, FHWND);

but my HookProc don't receive any message.
I must write a procedure to get the message like Spy++ on a specified form (Handle).

Thank 2 all
Question by:carmas123
LVL 13

Accepted Solution

ThievingSix earned 1000 total points
ID: 22937511

Author Comment

ID: 22940124
Hi and thanks very much for your solution,
but this solve my problem partialy.

I've edited the sample for me, but i've another problem now.
I want to intercept the message like WM_ACTIVATE or other like WM_USER
for only one form in a process, but your sample attach the wndproc to
a threadID and i receive all the message from all form in this thread.

I attach my sample.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question