0
Follow
2
View

What is the logic of this MFC custom message mapping function?

csgp521 注册会员
2023-02-25 12:12

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > the bit arithmetic logic here is will shift to the left one down command(2 times) and then with 0 bitwise or operation. The purpose of this is to use the last bit of the command number as a flag bit to indicate whether to wait for a response from the server. If waiting for a response, the flag bit is 1, otherwise it is 0. This allows the parameters to be combined by bit-operation so that the flag bits waiting for a response can be passed to the server when the command is sent. In the custom message response function, the argument is restored using a bit operation and the corresponding action is performed according to the command number.