Check out windows Cracker

Source: Internet
Author: User

Windows Cracker
Message splitting macros
Parameter decomposition can be done for messages
No need to remember or consult the material to understand the meaning of wparam and lparam
Can forget the old message processing method: Switch/case
Not suitable for large, complex applications that need to handle a large number of messages: coding is slow and program debugging and maintenance become slow as the application grows.
  

WindowsX.h
Contains three types of macros: Macro APIs, window message crackers, Control APIs
Advantages:
1) Reduce the number of forced type conversions and avoid errors in forced type conversions;
2) program readability enhancement;
3) Conversion between 16-bit and Win32 APIs;
4) Easy to understand (macro);
5) Easy to integrate with existing code;
6) can be used in C language and C + + language;
7) Can emulate the preparation of their own macros;
8) Using these macros, you don't have to care about and understand the hidden windows structure.

Code Demo:

#include <windows.h>#include<windowsx.h>#include<tchar.h>#include<cstdio>FILE* fp =NULL;/*BOOL Cls_oncreate (HWND hwnd, lpcreatestruct lpcreatestruct)*///#define HANDLE_WM_CREATE (hwnd, WParam, LParam, fn) (FN) ((HWND), (lpcreatestruct) (LParam)) 0L: (LRESULT) -1l)//#define FORWARD_WM_CREATE (hwnd, Lpcreatestruct, FN) (BOOL) (DWORD) (FN) (HWND), Wm_create, 0L, (LPARAM) ( lpcreatestruct) (lpcreatestruct))BOOL Fnwndproc_oncreate (HWND hwnd, lpcreatestruct lpcreatestruct) {fprintf (FP,"Entering fnwndproc_oncreate () \ n"); fprintf (FP,"hWnd =%u\n", (unsigned) hWnd); fprintf (FP,"leaving Fnwndproc_oncreate () \ n"); /*MSDN states wm_create should return 0 to continue and-1 for failure*/    //return FALSE;        /*But the Handle_wm_create macro translates return values greater than zero to 0, and the rest to-1.*/    returnTRUE;}/*void Cls_onsize (HWND hwnd, UINT State, int cx, int cy)*///#define HANDLE_WM_SIZE (hwnd, WParam, LParam, fn) (FN) ((HWND), (UINT) (WParam), (int) (short) LoWord (LParam), (int) ( Short) HiWord (LParam)), 0L)//#define FORWARD_WM_SIZE (hwnd, State, CX, CY, FN) (void) (FN) (HWND), Wm_size, (WPARAM) (UINT), Makelparam ((CX) , (CY)))voidFnwndproc_onsize (HWND hwnd, UINT State,intCxintcy) {fprintf (FP),"Entering fnwndproc_onsize () \ n"); fprintf (FP,"Width =%d\theight =%d\n", Cx,cy); fprintf (FP,"leaving Fnwndproc_onsize () \ n");}/*void Cls_onpaint (HWND hwnd)*///#define HANDLE_WM_PAINT (hwnd, WParam, LParam, FN) ((FN) (HWND), 0L)//#define FORWARD_WM_PAINT (hwnd, FN) (void) (FN) (HWND), WM_PAINT, 0L, 0L)voidFnwndproc_onpaint (HWND hwnd) {PAINTSTRUCT PS;    HDC hdc; fprintf (FP,"Entering fnwndproc_onpaint () \ n"); HDC=beginpaint (hwnd,&PS); fprintf (FP,"Painting window!\n"); fprintf (FP,"ps.rcPaint.right =%d\n",(int) ps.rcPaint.right); fprintf (FP,"Ps.rcPaint.bottom =%d\n",(int) ps.rcPaint.bottom); EndPaint (HWnd,&PS); fprintf (FP,"leaving Fnwndproc_onpaint () \ n");}/*void Cls_onclose (HWND hwnd)*///#define HANDLE_WM_CLOSE (hwnd, WParam, LParam, FN) ((FN) (HWND), 0L)//#define FORWARD_WM_CLOSE (hwnd, FN) (void) (FN) (HWND), WM_CLOSE, 0L, 0L)voidFnwndproc_onclose (HWND hwnd) {fprintf (FP,"Entering fnwndproc_onclose () \ n"); fprintf (FP,"hWnd =%u\n", (unsigned) hWnd);    DestroyWindow (HWND); fprintf (FP,"leaving Fnwndproc_onclose () \ n");}/*void Cls_ondestroy (HWND hwnd)*///#define Handle_wm_destroy (hwnd, WParam, LParam, FN) ((FN) (HWND), 0L)//#define Forward_wm_destroy (hwnd, FN) (void) (FN) (HWND), Wm_destroy, 0L, 0L)voidFnwndproc_ondestroy (HWND hwnd) {fprintf (FP,"Entering Fnwndproc_ondestroy () \ n"); fprintf (FP,"hWnd =%u\n", (unsigned) hWnd); PostQuitMessage (0); fprintf (FP,"leaving Fnwndproc_ondestroy () \ n");} LRESULT CALLBACK Fnwndproc (HWND hwnd, unsignedintmsg, WPARAM WPARAM, LPARAM LPARAM) {    Switch(msg) {handle_msg (hwnd, wm_create, fnwndproc_oncreate);        Handle_msg (hwnd, wm_size, fnwndproc_onsize);        Handle_msg (hwnd, WM_PAINT, Fnwndproc_onpaint);        Handle_msg (hwnd, WM_CLOSE, Fnwndproc_onclose);    Handle_msg (hwnd, Wm_destroy, Fnwndproc_ondestroy); default:return(DefWindowProc (hwnd, MSG, WParam, LParam)); }}intWINAPI WinMain (hinstance hIns, hinstance hprevins, LPSTR lpszargument,intnshow) {TCHAR szclassname[]= _t ("Debugging Windows Programs");    Wndclassex WC;    MSG messages;    HWND hwnd; Wc.lpszclassname= Szclassname; Wc.lpfnwndproc=Fnwndproc; Wc.cbsize=sizeof(Wndclassex); wc.style=cs_dblclks; Wc.hicon= LoadIcon (null,idi_application); Wc.hinstance=HIns; WC.HICONSM= LoadIcon (NULL, idi_application); Wc.hcursor=loadcursor (Null,idc_arrow); Wc.hbrbackground= (hbrush) Color_btnshadow; Wc.cbwndextra=0; Wc.lpszmenuname= NULL; Wc.cbclsextra=0; RegisterClassEx (&WC); FP= fopen ("Output.txt","W"); fprintf (FP,"Output.txt opened in WinMain () \ n"); HWnd= CreateWindowEx (0, Szclassname,szclassname,ws_overlappedwindow, the, the, the,305, Hwnd_desktop,0, HIns,0);    ShowWindow (hwnd,nshow);  while(GetMessage (&messages,null,0,0) {translatemessage (&messages); DispatchMessage (&messages); } fprintf (FP,"Output.txt Closed in WinMain () \ n");    Fclose (FP); returnMessages.wparam;}

Output Output.txt

Output.txt opened in WinMain ()  Entering fnwndproc_oncreate ()    hWnd = 658154  leaving Fnwndproc_oncreate ()  Entering fnwndproc_onsize ()    Width = 304Height = 267  Leaving Fnwndproc_onsize ()  Entering fnwndproc_onpaint ()    Painting window!    Ps.rcPaint.right  = 304    ps.rcPaint.bottom = 267  Leaving Fnwndproc_onpaint ()  Entering fnwndproc_ OnClose ()    hwnd = 658154    Entering Fnwndproc_ondestroy ()      hwnd = 658154    leaving Fnwndproc_ondestroy ()  leaving Fnwndproc_onclose () Output.txt Closed in WinMain ()

Reference: http://www.cplusplus.com/forum/windows/59737/

http://www.softpedia.com/get/Programming/SDK-DDK/Message-Cracker-Wizard.shtml (Message cracker Wizard)

An innovative tool makes every Windows developer forget on the old how to handling messages!

Baidu Cloud: http://pan.baidu.com/s/1dFkTds9%20 Password: 8q7o

 

    

Check out windows Cracker

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.