Message Cracker Wizard 2.1
Website:
http://usuarios.lycos.es/hernandp/mcw.html∞
Download:
Binary∞ or
Source∞
The Message Cracker Wizard makes the creation of windows easy using the Message Cracker macros from windowsx.h.
The program produces template code to your requirements and has an interface to select from over 140 Windows Messages to produce the template code. The code produced contains both the message cracking macro and the framework for the implementation of the message processing functions associated with each windows message. You can filter through Windows messages and the MCW supports both window and dialog types for creating the required callback function.
For a tutorial on how to use the 2.0 version of this program, please visit:
http://www.codeproject.com/win32/msgcrackwizard.asp∞
An example of code produced with the help of the MCW 2.1 is show below:
#include <windows.h>
// The important one, windowsx.h!
#include <windowsx.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// Forward declarations.
LRESULT CALLBACK DIBWindowProc(HWND, UINT, WPARAM, LPARAM);
BOOL DoCreate(HWND, LPCREATESTRUCT);
void DoDestroy(HWND);
void DoPaint(HWND);
void DoTimers(HWND, UINT);
// End forward declarations.
int APIENTRY _tWinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
WNDCLASS wc = {
0,
MyWindowProc,
0,0,
hInstance,
LoadIcon(NULL,IDI_APPLICATION),
LoadCursor(NULL,IDC_ARROW),
(HBRUSH)(COLOR_WINDOW+1),
NULL,
"MCWExample"
};
RegisterClass(&wc);
HWND hwnd = CreateWindowEx( 0L,
"MCWExample",
"Message Cracker Wizard Example!",
(WS_CAPTION | WS_SYSMENU),
CW_USEDEFAULT,0,
200,150,
HWND_DESKTOP,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,hwnd,0,0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK MyWindowProc( HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
HANDLE_MSG(hwnd,WM_CREATE,DoCreate);
HANDLE_MSG(hwnd,WM_DESTROY,DoDestroy);
HANDLE_MSG(hwnd,WM_PAINT,DoPaint);
HANDLE_MSG(hwnd,WM_TIMER,DoTimers);
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
BOOL DoCreate(HWND hwnd, LPCREATESTRUCT lpcs)
{
// Initialise stuff!
SetTimer(hwnd,1,32,NULL);
return TRUE;
}
void DoDestroy(HWND hwnd)
{
// Delete shit!
PostQuitMessage(NULL);
}
void DoPaint(HWND hwnd)
{
hdcScreen = BeginPaint(hwnd,&ps);
// Draw stuff!
EndPaint(hwnd,&ps);
}
void DoTimers(HWND hwnd, UINT id)
{
switch (id)
{
case 1:
break;
default:
break;
}
As you can see, the resulting code is easy to read, you simply 'register' functions to specific Windows Messages, rather than handling each message in a switch statement.
Categories
CategoryDefinitions
There are no comments on this page. [Add comment]