Joke Collection Website - Blessing messages - Use of postmessage and sendmessage in delphi
Use of postmessage and sendmessage in delphi
SendMessage sends the message and waits for the message to be processed, then returns to continue executing the program.
Form 1. Handle is the handle of the form 1 window.
VN_KEYDOWN is the message type of the key.
VK_TAB key value label
Win32 API message function: PostMessage
Function: This function puts (sends) the message into the message queue associated with the thread created by the specified window and returns it without waiting for the thread to process the message. Messages in the message queue are obtained by calling GetMessage and PeekMessage.
Function prototype: B00L PostMessage(HWND HWND, UINT Msg, WPARAM wParam, lparam lparam);
parameter
The window handle that the window program receives the message. Two values with specific meanings can be adopted:
HWND。 BROADCAST: Messages are sent to all top-level windows of the system, including invalid or invisible non-owned windows, overlay windows and pop-up windows. Messages are not sent to child windows.
NULL: The operation of this function is the same as calling the PostThreadMessage function with the parameter dwThread set as the current thread identifier.
Msg: Specifies the message to be sent.
WParam: Specifies additional information specific to the message.
IParam: Specifies additional information specific to the message.
Return value: if the function call is successful, a non-zero value is returned; If the function call fails, the return value is zero. To get more error information, call the GetLastError function.
Note: applications that need to communicate through HWND_BROADCAST should use the RegisterwindwosMessage function to obtain the unique message of communication between applications.
If you send a message to the asynchronous message function (PostMessage) under WM_USER. SendNotifyMessage, SendMesssgeCallback), message parameters cannot contain pointers. Otherwise, the operation fails. This function will return before the receiving thread processes the message, and the sender will release it before using the memory.
Quick check: Windows NT: 3. 1 and above; Windows: 95 and above; Windows CE: 1.0 and above; Header file: winuser.h;; Input library: user32.lib; ; Unicode: It is realized by Unicode and ANSI in Windows NT environment.
This article is from CSDN blog, please indicate the source:/Eddie Liu GD/archive/2004/12/07/207856.aspx.
- Previous article:How to use Huawei P9 multi-user mode?
- Next article:Afternoon greetings to clients
- Related articles
- Whether Jilin passenger transport will stop in 2020 and the arrangement of stopping trains.
- New Year’s greetings for friends
- Kumi ku6meta smart watch WeChat can't receive information.
- How to inquire the balance of ICBC card by SMS?
- Huawei matepad 1 1 fever problem?
- Spring Festival and Valentine's Day greetings are suitable for couples to pay New Year greetings.
- How to cancel mobile sub-number
- What does it mean to send a text message to say hello after an ex-boyfriend breaks up?
- What's so good about Apple do not disturb mode?
- Seven-night Valentine's Day greeting message