Windows thread message
The WaitMessage function suspends the thread and does not return until a new message is placed in the thread's message queue. If the function fails, the return value is zero. To get extended error information, call GetLastError. Note that WaitMessage does not return if there is unread input in the message queue after the thread has called a function to check the queue.
A subsequent call to WaitMessage will not return until new input of the specified type arrives. The existing unread input received prior to the last time the thread checked the queue is ignored. Clear instructions. Easy to follow. No jargon. Pictures helped. Didn't match my screen. Incorrect instructions.
Too technical. Not enough information. Not enough pictures. Any additional feedback? Submit feedback. Thank you for your feedback! GetQueueStatus returns an array of flags that indicates the types of messages in the queue; using it is the fastest way to discover whether the queue contains any messages.
Both of these functions can be used to determine whether the queue contains messages that need to be processed. You can post a message to a message queue by using the PostMessage function.
PostMessage places a message at the end of a thread's message queue and returns immediately, without waiting for the thread to process the message. The function's parameters include a window handle, a message identifier, and two message parameters. The system copies these parameters to an MSG structure, fills the time and pt members of the structure, and places the structure in the message queue. The system uses the window handle passed with the PostMessage function to determine which thread message queue should receive the message.
You can use the PostThreadMessage function to post a message to a specific thread message queue. PostThreadMessage is similar to PostMessage , except the first parameter is a thread identifier rather than a window handle. You can retrieve the thread identifier by calling the GetCurrentThreadId function.
Use the PostQuitMessage function to exit a message loop. The SendMessage function is used to send a message directly to a window procedure. SendMessage calls a window procedure and waits for that procedure to process the message and return a result. A message can be sent to any window in the system; all that is required is a window handle.
The system uses the handle to determine which window procedure should receive the message. Before processing a message that may have been sent from another thread, a window procedure should first call the InSendMessage function. If this function returns TRUE , the window procedure should call ReplyMessage before any function that causes the thread to yield control, as shown in the following example.
0コメント