Message crackers is a group of macros that encapsulate message ing provided by Platform SDK. It must contain header files.Windowsx. h.
The traditional message ing uses a large switch... case combination.CodeVery bloated. The framework of MFC solves this problem well, but sometimes we want to use only sdks for development. Using the macros provided by message crackers is a good choice.
Handle_msg macro for message ing
Lresult callback mainwndproc (hwnd, uint MSG, wparam,
Lparam)
{
Switch (MSG)
{
Handle_msg (hwnd, wm_command, oncommand );
Handle_msg (hwnd, wm_keyup, onkeyup );
Handle_msg (hwnd, wm_close, onclose );
Handle_msg (hwnd, wm_destroy, ondestroy );
Default: Return defwindowproc (hwnd, MSG, wparam, lparam );
}
}
In addition, when using the sendmessage and postmessage functions, You need to integrate multiple parameters into the wparam and lparam parameters. For example
Sendmessage (hwndparent, wm_command,
Makewparam (idc_userctl, bn_dblclk ),
(Lparam) getdlgitem (hwnd, id_userctl ));
However, message crackers provides the forward_wm_command macro. The preceding operations are simplified
Forward_wm_command (hwndparent, idc_userctl,
Getdlgitem (hwnd, id_userctl ),
Bn_dblclk, sendmessage );
In addition, message crackers also provides some control-related macros, such
# Define listbox_enable (hwndctl, fenable) enablewindow (hwndctl), (fenable ))
# Define listbox_getcount (hwndctl) (INT) (DWORD) sndmsg (hwndctl), lb_getcount, 0l, 0l ))
Finally, I want to mention that there is a tool calledMessage cracker wizard, which works with message ing macros, can be downloaded at http://www.codeproject.com/kb/winsdk/ms?ackwizard.aspx