Basic knowledge
SendMessage sends custom message and message response
The control sends a custom message to the parent form, which defines the function that handles this message
Program source code (the entire project) download: http://download.csdn.net/detail/qq2399431200/6274793
Effect description:
Specify which class to add custom messages: (Of course this class must be a subclass of CmdTarget, otherwise it cannot process messages)
Add message
Implement the message function: (wParam and lParam programmers can design what value to pass)
SendMessage parameter analysis (SendMessageA is a single-byte type function, SendMessageW is a double-byte function)
1: "Window" to receive this message, my place is the parent window
2: Message name, such as WM_USER + 4 or WM_MYMESSAGE
3: wParam parameter of the function that handles this message, the programmer can specify it by himself
4: The lParam parameter of the function that handles this message, the programmer can specify it by himself; I pass the value of the Silder control over
Instructions for use: The messages sent by SendMessage do not enter the message queue, but are directly processed by the corresponding message function. When SendMessage sends a message, it waits for the message processing function to finish executing before ending itself, and the subsequent code may run.
Summary: The secondary instance is just a control that sends a custom message to the parent form. It can even send Windows standard messages from one program to another. This usage is described next.
————————————————
Copyright statement: This article is an original article by the CSDN blogger "shmiloveyou", which follows the CC 4.0 BY-SA copyright agreement. Please reprint the original source link and this statement.
Original link: https://blog.csdn.net/qq2399431200/article/details/10999117