How the VC handles custom messages

Updated on technology 2024-05-12
8 answers
  1. Anonymous users2024-02-10

    ClassWizard does not allow the addition of user-defined messages, so you have to enter them manually. Once typed, ClassWizard will be able to process your custom messages just like any other message.

    Here are the steps to add a custom message:

    Step 1: Define the message. When developing Windows 95 applications, Microsoft recommends that user-defined messages be at least WM User+100, as many new controls also use WM User messages.

    Step 2: Implement the message handler. The function uses the wpram and lparam arguments and returns lpesult.

    lpesult cmainframe::onmymessage(wparam wparam, lparam lparam)

    todo: Handles user-defined messages.

    return 0;

    Step 3: Describe the message handling function in the afx msg block of the class header file

    class cmainframe:public cmdiframewnd

    General message mapping functions.

    protected:

    afx_msg

    declare_message_map()

    Step 4: In the message block of the user class, use the on message macro to map the message to the message handler.

    begin_message_map(cmainframe, cmdiframewnd)

    afx_msg_map

    end_message_map()

    If you need a message that is unique to the entire system, you can call the SDK function RegisterWindowMessage and use the On Register Message macro instead of the On Message macro, and the rest of the steps are the same as above.

  2. Anonymous users2024-02-09

    It's hard to say here.

    It's up to you to figure it out.

    It's not realistic.

  3. Anonymous users2024-02-08

    Define a global constant in the header file.

  4. Anonymous users2024-02-07

    Define global constants in the header file.

  5. Anonymous users2024-02-06

    A statement sends a custom message to a window or control, and the window or control that receives the message executes the corresponding response function.

    In a simple case, if the syntax allows, it is equivalent to the sender directly calling the receiver's response function.

    For example, if a::fun1() sends a message to window b, b responds to the message and executes b::fun2();

    People who don't know how to customize the message can remove the pointer to b in a::fun1() and use b->fun2(); Invoke the implementation.

    However, in some cases, when this direct call is not allowed (e.g. between two threads), you can only use custom messages to communicate and execute functions.

  6. Anonymous users2024-02-05

    By passing a custom message, a custom message handler is called. It can not conflict with system messages.

  7. Anonymous users2024-02-04

    This is a bug of VC itself, to solve this problem, you need to manually add the message function between }afx msg, otherwise VC may delete the message you added without giving any prompt.

  8. Anonymous users2024-02-03

    The message is thrown to ctestdlg, but you are processed in cresultdlg, which is not received. With: postmessage().

    Pass the handle of the receiving window in, and it's done.

Related questions
4 answers2024-05-12

After a traffic accident, the most important thing is how to deal with it, so how to claim compensation has become a question often asked by netizens, so today I will share this issue in a unified way. First of all, it needs to be emphasized that everyone must use legal means to deal with accidents, and cannot use excessive methods, which is not only not conducive to solving problems, but will also escalate contradictions, and may even violate the law. So what are the legal ways to make a claim? >>>More

7 answers2024-05-12

Your husband is afraid of him and even helps him everywhere The main thing is because they are a family But you shouldn't be afraid of him If you are afraid of offending him Then you will lose this fight Think about it It was originally the house that your father-in-law left to your little couple At that time, your husband's sister and brother had already agreed Now if you want to go back on your word and be treacherous, you just need to return two words to them: no way, you don't have to be afraid of them It is your own legitimate rights and interests You must work hard to defend Be tough Don't worry about anything If he (your husband's brother) dares to do anything excessive, you just call the police, and if it doesn't work, you go to court and sue them, and it's not that there is no evidence, and you are afraid that they will be lawless? No matter how powerful the ruffian is, he has to bow his head when he sees the law When the time is right, you can completely pick up the law to defend your legitimate rights and interests Good luck.

2 answers2024-05-12

It is said that the relationship between classmates is the most intimate and irreplaceable. But sometimes we are at a loss, and we don't know how to deal with our classmates. Here are some ways to help you easily deal with the relationship between your classmates and successfully reap a sincere friendship. >>>More

5 answers2024-05-12

Japan has invaded us several times in the past, causing great national harm to the Chinese people. China's attitude toward Japan is: We must not forget the hatred of the past, but also develop amicably with the Japanese people from generation to generation. >>>More

3 answers2024-05-12

Customer disputes can be handled in the following manner. >>>More