Events and messages in mfc

I am a little confused by the difference in events and messages in mfc. They are the same?

+3
source share
5 answers

Since you specifically ask a question about MFC, I assume that you mean event handlers and message handlers that you can define in the property windows of the MFC class.

In the "events" section you can define:

  • Handlers for Windows messages WM_COMMAND.
  • MFC handlers ON_UPDATE_COMMAND_UI.
  • Handlers for notifications to child windows, such as ON_BN_CLICKED, to handle the click of a button in a dialog box.

In the "Messages" section, you can define message handlers for other Windows messages.

See also some explanations in msdn

Win32, , , .

Windows ( MFC), ) Windows ( "", "", ).

, , ...

+5

Win32, :

- , . : . , ( WaitForSingleObject ) API SetEvent.

user32 , : , , ,...

+4

. .

+4

.

.

, . - - CreateEvent(). ; . ( , ). , , , , . , , Wait() .

, , - . , - , . , - , Wait(), .

, .

, " ", , , . ( ), . , - , - . , , , - , - , , . ( , , , - ).

+2

Dani is correct: in the MFC world, an β€œevent” is associated with a control and is transmitted through the WM_COMMAND message. "Message" is a broader term that covers all Windows messages. For an example, see msdn docs for BN_CLICKED .

This is a sad overload of the term β€œevent,” which is quite confusing. This is not due to events in the wider Win32 world that are objects of kernel synchronization.

0
source

Source: https://habr.com/ru/post/1705536/


All Articles