• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1339
  • Last Modified:

Windows Hook WNDPROC

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 +
        PROCESS_QUERY_INFORMATION +
        PROCESS_VM_OPERATION +
        PROCESS_VM_WRITE +
        PROCESS_VM_READ,
        False,
        LPID
        );
      if LPID <> 0 then begin
        KBHook := SetWindowsHookEx(WH_CALLWNDPROC, @HookProc, LProcess, FHWND);
      end;

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
0
carmas123
Asked:
carmas123
1 Solution
 
Dagan HooverDeveloperCommented:
0
 
carmas123Author Commented:
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.
thank
myHOOK.zip
0
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.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now