⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editdlg.c

📁 Programming Windows CE Windows CE程序设计书籍源代码
💻 C
字号:
//======================================================================
// EditDlg - Edit 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 nlEdit[] = {{TEXT ("EN_SETFOCUS "), 0x0100},
                       {TEXT ("EN_KILLFOCUS"), 0x0200},
                       {TEXT ("EN_CHANGE   "), 0x0300},
                       {TEXT ("EN_UPDATE   "), 0x0400},
                       {TEXT ("EN_ERRSPACE "), 0x0500},
                       {TEXT ("EN_MAXTEXT  "), 0x0501},
                       {TEXT ("EN_HSCROLL  "), 0x0601},
                       {TEXT ("EN_VSCROLL  "), 0x0602},
};
extern NOTELABELS nlPropPage[];
extern int nPropPageSize;
//======================================================================
// EditDlgProc - Button page dialog box procedure
//
BOOL CALLBACK EditDlgProc (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(nlEdit); i++) {
                if (HIWORD (wParam) == nlEdit[i].wNotification) {
                    lstrcat (szOut, nlEdit[i].pszLabel);
                    break;
                }
            }
            if (i == dim(nlEdit))
                wsprintf (szOut, TEXT ("WM_COMMAND notification: %x"),
                          HIWORD (wParam));

            SendMessage (hwndMain, MYMSG_ADDLINE,
                         MAKEWPARAM (LOWORD (wParam),ID_EDITPAGE),
                         (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_EDITPAGE), (LPARAM)szOut);

            return FALSE;  // Return false to force default processing.
    }
    return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -