page2dlg.cpp

来自「《Windows CE 6.0开发者参考》(《Programming Windo」· C++ 代码 · 共 61 行

CPP
61
字号
//======================================================================
// Page2DlgProc - Button dialog box window code
//
// Written for the book Programming Windows CE
// Copyright (C) 2007 Douglas Boling
//======================================================================
#include <windows.h>                 // For all that Windows stuff
#include <commctrl.h>                // Common Control includes
#include <prsht.h>                   // Property sheet includes
#include "DlgDemo.h"                 // Program-specific stuff

//======================================================================
// Page2DlgProc - Button page dialog box procedure
//
BOOL CALLBACK Page2DlgProc (HWND hWnd, UINT wMsg, WPARAM wParam,
                          LPARAM lParam) {
    int i;
    switch (wMsg) {
        case WM_INITDIALOG:
            i = SendDlgItemMessage (hWnd, IDC_TRACKBAR, 
                                    TBM_GETRANGEMAX, 0, 0);
            SendDlgItemMessage (hWnd, IDC_PROGRESS, 
                                PBM_SETRANGE, 0, MAKELPARAM (0, i));
            return TRUE;
        //
        // Reflect WM_COMMAND messages to main window.
        //
        case WM_COMMAND:
            PrintCmdMessage (wParam, lParam, NULL, 0);
            return TRUE;

        //
        // Reflect notify message.
        //
        case WM_NOTIFY:
            PrintNotMessage (lParam, NULL, 0);
            return FALSE;  // Return false to force default processing.

        //
        // Reflect scroll bar messages that are generated by Trackbar
        //
        case WM_VSCROLL:
            RptMessage (-1, TEXT("WM_VSCROLL from Trackbar msg %d"), 
                        LOWORD (wParam));
            return FALSE;

        case WM_HSCROLL:
            RptMessage (-1, TEXT("WM_HSCROLL from Trackbar msg %d"), 
                        LOWORD (wParam));

            // Get the position of the trackbar
            i = SendDlgItemMessage (hWnd, IDC_TRACKBAR, TBM_GETPOS, 0, 0);

            // Set the progress bar control
            SendDlgItemMessage (hWnd, IDC_PROGRESS, PBM_SETPOS, i, 0);
            return FALSE;
    }
    return FALSE;
}

⌨️ 快捷键说明

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