Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: intercept windows message


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Apr 9, 2018 8:53 PM Last Post By: marshal yadav Threads: [ Previous | Next ]
pasal cloup

Posts: 3
Registered: 9/28/14
intercept windows message  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 16, 2014 7:18 AM
Hi,

I need to intercept in a Delphi program a Windows message sent by a COM component using SendMessageCallback/SendMessage win32 api functions.

I tried using TApplication.OnMessage, but as it is explained in the doc this not works.

A also tried to overload the WindProc procedure, but my procedure is never called (?).
As I"m new to Delphi, i assume that i forget something.

Someone can help?
Thanks in advance
Pascal
Remy Lebeau (Te...


Posts: 9,448
Registered: 12/23/01
Re: intercept windows message  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 16, 2014 9:57 AM   in response to: pasal cloup in response to: pasal cloup
pasal wrote:

I need to intercept in a Delphi program a Windows message sent by a
COM component using SendMessageCallback/SendMessage win32 api
functions.

Which HWND is the COM object sending its message(s) to? It makes a big difference
in how you can intercept them.

I tried using TApplication.OnMessage, but as it is explained in the
doc this not works.

That event only works for messages that are posted to the main thread's message
queue. The SendMessage...() family of functions do not post messages to
a message queue.

A also tried to overload the WindProc procedure, but my procedure is
never called (?).

That only works if the COM object is using your Form's window as the target
HWND for the message(s).

--
Remy Lebeau (TeamB)
pasal cloup

Posts: 3
Registered: 9/28/14
Re: intercept windows message  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2014 3:28 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hello Remy,

I Transmit the Handle of my form to the component this way: Form1.Handle.

But my WndProc procedure is never called, not only after the COM component sends its message. my WndProc procedure does not receive any message.

Any idea?
Pascal
pasal cloup

Posts: 3
Registered: 9/28/14
Re: intercept windows message  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2014 4:13 AM   in response to: pasal cloup in response to: pasal cloup
Hi,

i found the solution. Overloading the WndProc procedure is not sufficient.
The essential thing is to initialize WindowProc with the overloaded procedure (or other message processing procedure).

Pascal
marshal yadav

Posts: 2
Registered: 5/10/18
Re: intercept windows message  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 9, 2018 8:53 PM   in response to: pasal cloup in response to: pasal cloup
Play free mahjongg dimensions big game for the http://mahjongdimensions.me/ mobile play that is great.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02