progressdialog.cpp

来自「AES, 即Advanced Encryption Standard高级加密标准」· C++ 代码 · 共 94 行

CPP
94
字号
/*
 *  ProgressDialog.cpp
 *
 *  Copyright (C) 2006
 *  Paul E. Jones <paulej@arid.us>
 *  All Rights Reserved.
 *
 ******************************************************************************
 *  $Id: ProgressDialog.cpp,v 1.5 2008/05/26 01:07:25 paulej Exp $
 ******************************************************************************
 *
 *  This module implements a simple progress box for showing the progress
 *  of file encryption and decryption.
 *
 */

#include "stdafx.h"
#include "ProgressDialog.h"

/*
 *  ProgressDialog Constructor
 */
ProgressDialog::ProgressDialog()
{
    abort_processing = false;
}

/*
 *  ProgressDialog Destructor
 */
ProgressDialog::~ProgressDialog()
{
}

/*
 *  OnInitDialog
 */
LRESULT ProgressDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    OSVERSIONINFO os_version_info;
    HICON hicon;

    CAxDialogImpl<ProgressDialog>::OnInitDialog(uMsg, wParam, lParam, bHandled);
    bHandled = TRUE;

    hicon = (HICON) ::LoadImage(_AtlBaseModule.GetResourceInstance(),
                                MAKEINTRESOURCE(IDI_AESCRYPT),
                                IMAGE_ICON,
                                LR_DEFAULTSIZE,
                                LR_DEFAULTSIZE,
                                LR_SHARED);

    SetIcon(hicon);

    // Center the dialog in the active window
    CenterWindow(GetForegroundWindow());

    // We set the lParam value when we create the window
    if (lParam)
    {
        SetDlgItemText( IDC_ENCRYPTINGMSG,
                        _T("Encrypting..."));
    }
    else
    {
        SetDlgItemText( IDC_ENCRYPTINGMSG,
                        _T("Decrypting..."));
    }

    // If the major OS version is less than 5, then set the status bar color
    // manually, otherwise we'll let the system use its defaults.
    GetVersionEx(&os_version_info);
    if (os_version_info.dwMajorVersion < 5)
    {
        // Set the progress bar color
        SendDlgItemMessage( IDC_PROGRESSBAR,
                            PBM_SETBARCOLOR,
                            0,
                            (LPARAM) (COLORREF) RGB(0,102,204));
    }

    return 1;  // Let the system set the focus
}

/*
 *  OnClickedCancel
 */
LRESULT ProgressDialog::OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
    abort_processing = true;
    return 0;
}

⌨️ 快捷键说明

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