📄 dlgdemo.h
字号:
//======================================================================
// Header file
//
// Written for the book Programming Windows CE
// Copyright (C) 1998 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 IDC_CMDBAR 1 // Command bar ID
#define IDC_RPTLIST 2 // ID for report list box
#define ID_ICON 10 // Icon resource ID
#define ID_MENU 11 // Main menu resource ID
// Menu item IDs
#define IDM_OPEN 100
#define IDM_SAVE 101
#define IDM_COLOR 102
#define IDM_PRINT 103
#define IDM_SHOWPROPSHEET 104
#define IDM_SHOWMODELESS 105
#define IDM_EXIT 106
#define IDM_ABOUT 110
#define IDI_BTNICON 120
// Identifiers for the property page resources
#define ID_BTNPAGE 50
#define ID_EDITPAGE 51
#define ID_LISTPAGE 52
#define ID_STATPAGE 53
#define ID_SCROLLPAGE 54
// Button window defines
#define IDC_PUSHBTN 200
#define IDC_CHKBOX 201
#define IDC_ACHKBOX 202
#define IDC_A3STBOX 203
#define IDC_RADIO1 204
#define IDC_RADIO2 205
#define IDC_OWNRDRAW 206
// Edit window defines
#define IDC_SINGLELINE 210
#define IDC_MULTILINE 211
#define IDC_PASSBOX 212
// List box window defines
#define IDC_COMBOBOX 220
#define IDC_SNGLELIST 221
#define IDC_MULTILIST 222
// Static control window defines
#define IDC_LEFTTEXT 230
#define IDC_RIGHTTEXT 231
#define IDC_CENTERTEXT 232
#define IDC_ICONCTL 233
#define IDC_BITMAPCTL 234
// Scroll bar window defines
#define IDC_LRSCROLL 240
#define IDC_UDSCROLL 241
// Control IDs for modeless dialog box
#define IDD_CLEAR 500
// User-defined message to add a line to the window
#define MYMSG_ADDLINE (WM_USER + 10)
//----------------------------------------------------------------------
// Program-specific structures
//
typedef struct {
TCHAR *pszLabel;
DWORD wNotification;
} NOTELABELS, *PNOTELABELS;
//----------------------------------------------------------------------
// Function prototypes
//
int InitApp (HINSTANCE);
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 DoCommandMain (HWND, UINT, WPARAM, LPARAM);
LRESULT DoAddLineMain (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM);
// Command functions
LPARAM DoMainCommandOpen (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandSave (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandColor (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandPrint (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandShowProp (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandModeless (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandExit (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandAbout (HWND, WORD, HWND, WORD);
// Dialog box procedures
BOOL CALLBACK BtnDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK EditDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ListDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK StaticDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ScrollDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ModelessDlgProc (HWND, UINT, WPARAM, LPARAM);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -