www.pudn.com > CeChat.rar > CeChat.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. 
}; 
//---------------------------------------------------------------------- 
// Generic defines used by application 
#define  ID_ICON             1                  // App icon resource ID 
#define  ID_MENU             2                  // Menu resource ID 
#define  ID_ACCEL            3                  // Accel table ID 
#define  IDC_CMDBAR          4                  // Command band ID 
#define  ID_RCVTEXT          5                  // Receive text box 
#define  ID_SENDTEXT         6                  // Send text box 
#define  ID_SENDBTN          7                  // Send button 
// Menu item IDs 
#define  IDM_EXIT            1 
 
#define  IDM_USECOM          110                // Use COM. 
#define  IDM_ABOUT           120                // Help menu 
 
// Command bar IDs 
#define  IDC_COMPORT         150                // COM port combo box 
#define  IDC_BAUDRATE        151                // Baud rate combo box 
 
#define TEXTSIZE 256 
//---------------------------------------------------------------------- 
// Function prototypes 
// 
DWORD WINAPI ReadThread (PVOID pArg); 
DWORD WINAPI SendThread (PVOID pArg); 
HANDLE InitCommunication (HWND, LPTSTR); 
int FillComComboBox (HWND); 
 
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 DoSizeMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoSetFocusMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoPocketPCShell (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoCommandMain (HWND, UINT, WPARAM, LPARAM); 
LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM); 
// Command functions 
LPARAM DoMainCommandExit (HWND, WORD, HWND, WORD); 
LPARAM DoMainCommandComPort (HWND, WORD, HWND, WORD); 
LPARAM DoMainCommandSendText (HWND, WORD, HWND, WORD); 
LPARAM DoMainCommandAbout (HWND, WORD, HWND, WORD); 
 
// Dialog procedures 
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM); 
BOOL CALLBACK EditAlbumDlgProc (HWND, UINT, WPARAM, LPARAM);