delphi - Sending messages to TApplication -


I have an application that can send messages to other applications. Under Pre-Win 8 system, which works fine. You give it a square or title, it uses the nimvindooundo and finds the target window. With Win8, you can only calculate top-level windows, which means the TApplication class. The sender is happy with that, but the receiver is not.

To capture this message, I am using this code inside my target form ...

  function Tmain.AppMsgHookFunc (var wmsg: TMessage): Boolean; Start the result: = False; If wmsg.msg = WM_COPYDATA starts then / sent the message sent back to this form. Postmessage (handle, wmsg.msg, wmsg.WParam, wmsg.LParam); End; End;   

... and then activate it with application.hookmainwindow etc.

It never fire. I think if I send a message to send my message then it fires, but if I use postmags that do not work, even on XP Any suggestions?

WM_COPYDATA is a message sent to system martial data cross-process For this, the system should know that the message has been processed to be able to organize the resources used to be cross-processed. And the way the system knows that the message has been processed, it is compelling you to send it in sync. This means that you have to use SendMessage instead of PostMessage .

It also contains this information, however you need to explain it.

WM_COPYDATA sends an application to pass data to another application.

Note the use of the word "sends". This message is the code for synchronous.

Raymond Chen discusses this issue here:

The key difference from a message like WM_COPY DETA is that the window manager with the message sent knows that the message Processing is complete: At the time when the window process returns, it can free the temporary buffers used from the sender to martial the message to the recipient. If the message was posted, then the window manager will never be sure.

Suppose that the message is placed in MSG structure, as the result of the column is the gatemessage. Now the window manager knows that the receiving thread has the ability to act on the message and buffers need to be valid but how will it know when buffers can be free? "OK, you can wait until the exact same parameter is found in the dispatchmessages function in MSG structure." But what if the message removes the loop message? Or if he decides to send it twice? Or if it decides to smuggle it inside any other message?

The posted messages are not a guarantee of delivery nor do they provide any information when the message is processed, or even processed . If the window manager allows you to post a WM_COPY DATA message, then his mental powers will be used when memory can be freed.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -