Little experience regarding PostMessage and SendMessage

zhaozj2021-02-12  153

After using a hook program to intercept the message, use sendMessage to send the message to the primary handler, but when the main handler has not completed the task, the program set the hook will enter the stopped state, and cannot be processed.

WM_PAINT,

WM_MOVE,

......., etc.

You must continue to run after the message sent by SendMessage, can continue to run, the entire interface is blank, and the hook message is set to PostMessage Send message form, the problem is solved!

I checked MSDN's definition of these two APIs,

PostMessage just puts the message into the queue, whether or not other programs are handled, then continue;

SendMessage must wait for other programs to process the message and return, continue.

PostMessage's return value indicates whether the postMessage function is executed correctly;

The return value of SendMessage indicates the return value after another program handles the message.

The most important thing to use these two sending message functions is to see if your program is to be hysteresis, postmessage will cause the hysteresis of the message, while SendMessage will not, but if the sendMessage message failed, Cause the program stop!

转载请注明原文地址:https://www.9cbs.com/read-6385.html

New Post(0)