www.pudn.com > KeyTrac.rar > KeyTrac.h


//====================================================================== 
// Header file 
// 
// Written for the book Programming Windows CE 
// Copyright (C) 2003 Douglas Boling 
//====================================================================== 
// Returns number of elements 
#define dim(x) (sizeof(x) / sizeof(x[0])) 
 
//---------------------------------------------------------------------- 
// Generic defines and data types 
// 
struct decodeUINT {                             // Structure associates 
    UINT Code;                                  // messages 
                                                // with a function. 
    LRESULT (*Fxn)(HWND, UINT, WPARAM, LPARAM); 
};  
struct decodeCMD {                              // Structure associates 
    UINT Code;                                  // menu IDs with a 
    LRESULT (*Fxn)(HWND, WORD, HWND, WORD);     // function. 
}; 
 
//---------------------------------------------------------------------- 
// Program-specific defines and structures 
// 
typedef struct { 
    UINT wKeyMsg; 
    INT wParam; 
    INT lParam; 
    LPCTSTR pszMsgTxt; 
    TCHAR szShift[20]; 
} MYKEYARRAY, *PMYKEYARRAY; 
 
// Structure to associate messages with text name of message 
typedef struct { 
    UINT wMsg; 
    LPCTSTR pName; 
} KEYNAMESTRUCT; 
 
//---------------------------------------------------------------------- 
// Function prototypes 
// 
HWND InitInstance (HINSTANCE, LPWSTR, int); 
int TermInstance (HINSTANCE, int); 
 
// Window procedures 
LRESULT CALLBACK MainWndProc (HWND, UINT, WPARAM, LPARAM); 
// Message handlers 
LRESULT DoCreateMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoPaintMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoKeysMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM);