This is a toy implementation of a legacy code using MFC. OnBnClickedButton is an event handler but it contains codes which are executed asynchronously in a different thread ( may be a bad idea). The declaration syntax is accepted by the message map.
//declaration
afx_msg void OnBnClickedButton();
//message map
ON_BN_CLICKED(IDC_BUTTON, &CMFCApplicationDlg::OnBnClickedButton)
Now I want to add a callback to the event handler like so, but the message-map won't accept the new declaration syntax, where to go?
afx_msg void OnBnClickedButton(std::optional<std::function<CString(void)>> callback);