📄 ctlview.h
字号:
//======================================================================
// Header file
//
// Written for the book Programming Windows CE
// Copyright (C) 2007 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);
};
//----------------------------------------------------------------------
// Generic defines used by application
#define IDI_BTNICON 20 // Icon used on button
#define ID_ICON 1 // Icon ID
#define IDC_CMDBAR 2 // Command bar ID
#define IDC_RPTLIST 3 // Report window ID
// Client window IDs go from 5 through 9.
#define IDC_WNDSEL 5 // Starting client
// window IDs
// Radio button IDs go from 10 through 14.
#define IDC_RADIOBTNS 10 // Starting ID of
// radio buttons
// Button window defines
#define IDC_PUSHBTN 100
#define IDC_CHKBOX 101
#define IDC_ACHKBOX 102
#define IDC_A3STBOX 103
#define IDC_RADIO1 104
#define IDC_RADIO2 105
#define IDC_OWNRDRAW 106
// Edit window defines
#define IDC_SINGLELINE 100
#define IDC_MULTILINE 101
#define IDC_PASSBOX 102
// List box window defines
#define IDC_COMBOBOX 100
#define IDC_SNGLELIST 101
#define IDC_MULTILIST 102
// Static control window defines
#define IDC_LEFTTEXT 100
#define IDC_RIGHTTEXT 101
#define IDC_CENTERTEXT 102
#define IDC_ICONCTL 103
#define IDC_BITMAPCTL 104
// Scroll bar window defines
#define IDC_LRSCROLL 100
#define IDC_UDSCROLL 101
// User-defined message to add a line to the window
#define MYMSG_ADDLINE (WM_USER + 10)
typedef struct {
TCHAR *szClass;
INT nID;
TCHAR *szTitle;
INT x;
INT y;
INT cx;
INT cy;
DWORD lStyle;
} CTLWNDSTRUCT, *PCTLWNDSTRUCT;
typedef struct {
WORD wMsg;
INT nID;
WPARAM wParam;
LPARAM lParam;
} CTLMSG, * PCTLMSG;
typedef struct {
TCHAR *pszLabel;
WORD wNotification;
} NOTELABELS, *PNOTELABELS;
//----------------------------------------------------------------------
// Function prototypes
//
int InitApp (HINSTANCE);
HWND InitInstance (HINSTANCE, LPWSTR, int);
int TermInstance (HINSTANCE, int);
LRESULT PrintCmdMessage (HWND hWnd, WPARAM wParam, LPARAM lParam,
PNOTELABELS lpStruct, int nDim);
void RptMessage (HWND hWnd, DWORD id, LPTSTR lpszFormat, ...);
// Window procedures
LRESULT CALLBACK FrameWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK ClientWndProc (HWND, UINT, WPARAM, LPARAM);
// Message handlers
LRESULT DoCreateFrame (HWND, UINT, WPARAM, LPARAM);
LRESULT DoSizeFrame (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandFrame (HWND, UINT, WPARAM, LPARAM);
LRESULT DoAddLineFrame (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDestroyFrame (HWND, UINT, WPARAM, LPARAM);
//----------------------------------------------------------------------
// Window prototypes and defines for BtnWnd
//
#define BTNWND TEXT ("ButtonWnd")
int InitBtnWnd (HINSTANCE);
// Window procedures
LRESULT CALLBACK BtnWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCreateBtnWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCtlColorBtnWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandBtnWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDrawItemBtnWnd (HWND, UINT, WPARAM, LPARAM);
//----------------------------------------------------------------------
// Window prototypes and defines for EditWnd
//
#define EDITWND TEXT ("EditWnd")
int InitEditWnd (HINSTANCE);
// Window procedures
LRESULT CALLBACK EditWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCreateEditWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandEditWnd (HWND, UINT, WPARAM, LPARAM);
//----------------------------------------------------------------------
// Window prototypes and defines for ListWnd
//
#define LISTWND TEXT ("ListWnd")
int InitListWnd (HINSTANCE);
// Window procedures
LRESULT CALLBACK ListWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCreateListWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandListWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDrawItemListWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoMeasureItemListWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCompareItemListWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDelItemListWnd (HWND, UINT, WPARAM, LPARAM);
//----------------------------------------------------------------------
// Window prototypes and defines for StatWnd
//
#define STATWND TEXT ("StaticWnd")
int InitStatWnd (HINSTANCE);
// Window procedures
LRESULT CALLBACK StatWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCreateStatWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandStatWnd (HWND, UINT, WPARAM, LPARAM);
//----------------------------------------------------------------------
// Window prototypes and defines ScrollWnd
//
#define SCROLLWND TEXT ("ScrollWnd")
int InitScrollWnd (HINSTANCE);
// Window procedures
LRESULT CALLBACK ScrollWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCreateScrollWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoVScrollScrollWnd (HWND, UINT, WPARAM, LPARAM);
LRESULT DoHScrollScrollWnd (HWND, UINT, WPARAM, LPARAM);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -