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

📄 securityoptionsdialog.cpp

📁 通过手机蓝牙控制个人电脑上的幻灯片的播放
💻 CPP
字号:
// SecurityOptionsDialog.cpp
//
// Dialog that is displayed when a logged on user presses Control-Alt-Delete.
//

#include "stdafx.h"
#include "SecurityOptionsDialog.h"
#include "GuiHelper.h"
#include "SecurityHelper.h"

#include "resource.h"
#include "ntsecapi.h"

void SecurityOptionsDialog::_changePassword() {
    // this sample does not implement this functionality, but here are some tips:
    //   1) Use NetUserChangePassword to attempt the password change
    //   2) Use SecureZeroMemory to clear out any buffers that hold passwords
    _pWinLogon->wlxMessageBox(_hwnd, L"Your password change dialog goes here!", L"Change Password", MB_ICONINFORMATION);
}

bool SecurityOptionsDialog::_confirmLogoff() {
    return IDOK == _pWinLogon->wlxMessageBox(_hwnd, L"Are you sure you want to log off?", L"Log Off Windows", MB_ICONQUESTION | MB_OKCANCEL);
}

bool SecurityOptionsDialog::_confirmShutdown() {
    return IDOK == _pWinLogon->wlxMessageBox(_hwnd, L"Are you sure you want to shut down?", L"Shut Down Windows", MB_ICONQUESTION | MB_OKCANCEL);
}

INT_PTR SecurityOptionsDialog::DialogProc(UINT msg, WPARAM wp, LPARAM lp) {
    switch (msg) {

        case WM_INITDIALOG: {
            wchar_t loginMsg[6 + MAX_SIZE_USER_NAME] = L"User: ";
            if (SecurityHelper::ImpersonateAndGetUserName(_hToken, loginMsg + 6, MAX_SIZE_USER_NAME)) {
                GuiHelper::SetControlText(_hwnd, IDC_NAME, loginMsg);
            }
            
            GuiHelper::CenterWindow(_hwnd);
            return TRUE;
        }
        case WM_COMMAND: {
            switch (LOWORD(wp)) {
                case IDC_LOCK:
                    EndDialog(_hwnd, Lock);
                    break;
                case IDC_LOGOFF:
                    if (_confirmLogoff()) EndDialog(_hwnd, Logoff);
                    break;
                case IDC_SHUTDOWN:
                    if (_confirmShutdown()) EndDialog(_hwnd, Shutdown);
                    break;
                case IDC_CHANGEPASS:
                    _changePassword();
                    EndDialog(_hwnd, IDCANCEL);
                    break;
                case IDC_TASKMAN:
                    EndDialog(_hwnd, TaskMan);
                    break;
                case IDCANCEL:
                    EndDialog(_hwnd, IDCANCEL);
                    break;
            }
            return TRUE;
        }
    }
    return FALSE;
}

⌨️ 快捷键说明

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