In the document program, you need to customize the toolbar. When you use the resource editor to add a Custom button to the toolbar, the button becomes unavailable when you run the program. This is because the button does not have a message response function. Next, we will add a message Response Function in the new toolbar button with ID id_my_search in the View class.
1. Add the declaration of the Command Message response function to the view header file.
Afx_msg void onmysearch ();
2. Add the message ing in the View class. cpp file message ing table.
Begin_message_map (ccenterserverview, clistview) ...... on_command (id_my_search, onmysearch) end_message_map ()
3. Implement the message Response Function in the View class. cpp file.
Void ccenterserverview: onmysearch () {afxmessagebox (_ T ("test "));}
Then, compile and run the program again and find that the newly added id_my_search button is available. Click this button to bring up the test message dialog box.