📄 staticdlg.c
字号:
//======================================================================
// StaticDlg - Static control dialog box window code
//
// Written for the book Programming Windows CE
// Copyright (C) 1998 Douglas Boling
//======================================================================
#include <windows.h> // For all that Windows stuff
#include <prsht.h> // Property sheet includes
#include "DlgDemo.h" // Program-specific stuff
extern HINSTANCE hInst;
//----------------------------------------------------------------------
// Global data
//
// Identification strings for various WM_COMMAND notifications
NOTELABELS nlStatic[] = {{TEXT ("STN_CLICKED"), 0},
{TEXT ("STN_ENABLE "), 2},
{TEXT ("STN_DISABLE"), 3},
};
extern NOTELABELS nlPropPage[];
extern int nPropPageSize;
//======================================================================
// StaticDlgProc - Button page dialog box procedure
//
BOOL CALLBACK StaticDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam,
LPARAM lParam) {
TCHAR szOut[128];
HWND hwndMain;
INT i;
switch (wMsg) {
case WM_INITDIALOG:
// The generic parameter contains the
// top-level window handle.
hwndMain = (HWND)((LPPROPSHEETPAGE)lParam)->lParam;
// Save the window handle in the window structure.
SetWindowLong (hWnd, DWL_USER, (LONG)hwndMain);
return TRUE;
//
// Reflect WM_COMMAND messages to main window.
//
case WM_COMMAND:
// Get the handle of the main window from the user word.
hwndMain = (HWND) GetWindowLong (hWnd, DWL_USER);
// Look up button notification.
lstrcpy (szOut, TEXT ("WM_COMMAND: "));
for (i = 0; i < dim(nlStatic); i++) {
if (HIWORD (wParam) == nlStatic[i].wNotification) {
lstrcat (szOut, nlStatic[i].pszLabel);
break;
}
}
if (i == dim(nlStatic))
wsprintf (szOut, TEXT ("WM_COMMAND notification: %x"),
HIWORD (wParam));
SendMessage (hwndMain, MYMSG_ADDLINE,
MAKEWPARAM (LOWORD (wParam),ID_STATPAGE),
(LPARAM)szOut);
return TRUE;
//
// Reflect notify message.
//
case WM_NOTIFY:
// Get the handle of the main window from the user word.
hwndMain = (HWND) GetWindowLong (hWnd, DWL_USER);
// Look up notify message.
for (i = 0; i < nPropPageSize; i++) {
if (((NMHDR *)lParam)->code ==
nlPropPage[i].wNotification) {
lstrcpy (szOut, nlPropPage[i].pszLabel);
break;
}
}
if (i == nPropPageSize)
wsprintf (szOut, TEXT ("Notify code:%d"),
((NMHDR *)lParam)->code);
SendMessage (hwndMain, MYMSG_ADDLINE,
MAKEWPARAM (-1,ID_STATPAGE), (LPARAM)szOut);
return FALSE; // Return false to force default processing.
}
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -