📄 dlgdemo.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);
};
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
#define IDM_OPEN 100 // Menu item IDs
#define IDM_SAVE 101
#define IDM_COLOR 102
#define IDM_PRINT 103
#define IDM_FONT 104
#define IDM_SHOWPROPSHEET 105
#define IDM_SHOWSCROLLABLE 106
#define IDM_SHOWMODELESS 107
#define IDM_EXIT 108
#define IDM_ABOUT 110
#define IDI_BTNICON 120
// Identifiers for the property page resources
#define ID_PAGE1 50
#define ID_PAGE2 51
#define IDC_MONTHCAL 200 // Page 1 defines
#define IDC_TRACKBAR 210 // Page 2 defines
#define IDC_PROGRESS 211
#define IDC_BUTTON 300 // Scroll dlg defines
#define IDC_CHKBOX 301
#define IDC_ACHKBOX 302
#define IDC_A3STBOX 303
#define IDC_RADIO1 304
#define IDC_RADIO2 305
// 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 + 100)
//----------------------------------------------------------------------
// Program-specific structures
//
typedef struct {
TCHAR *pszLabel;
DWORD wNotification;
} NOTELABELS, *PNOTELABELS;
//----------------------------------------------------------------------
// Function prototypes
//
HWND InitInstance (HINSTANCE, LPWSTR, int);
int TermInstance (HINSTANCE, int);
void RptMessage (DWORD id, LPTSTR lpszFormat, ...);
LRESULT PrintNotMessage (LPARAM, PNOTELABELS, int);
LRESULT PrintCmdMessage (WPARAM, LPARAM, PNOTELABELS, 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 DoMainCommandFont (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandShowProp (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandModeless (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandScrollable (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandExit (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandAbout (HWND, WORD, HWND, WORD);
// Dialog box procedures
BOOL CALLBACK Page1DlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK Page2DlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ModelessDlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ScrollableDlgProc (HWND, UINT, WPARAM, LPARAM);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -