📄 configration.cpp
字号:
// Configration.cpp: implementation of the CConfigration class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "WMVC.h"
#include "Configration.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CConfigration::CConfigration()
{
LONG nErr = m_reg.Create(HKEY_LOCAL_MACHINE, "Software\\VCBook\\WMWB");
if (ERROR_SUCCESS != nErr)
{
AfxThrowResourceException();
}
}
CConfigration::~CConfigration()
{
m_reg.Close();
}
//把对象中所有的成员序列化到注册表中
void CConfigration::Save()
{
m_reg.SetValue(m_strVersion, "Version");
m_reg.SetValue(m_dwHotKey, "HotKey");
m_reg.SetValue(m_dwKeyboardLayout, "KeyboardLayout");
m_reg.SetValue(m_dwStopPromptMin, "StopPromptMin");
}
//把注册表中所有的配置信息加载到对象中
void CConfigration::Load()
{
DWORD dwCount = 256;
CString strTemp;
m_reg.QueryValue(strTemp.GetBuffer(dwCount), "Version", &dwCount);
strTemp.ReleaseBuffer(-1);
if ("" == strTemp)
{
m_strVersion = "1.0";
}
else
{
m_strVersion = strTemp;
}
//取出KeyboardLayout
m_reg.QueryValue(m_dwKeyboardLayout, "KeyboardLayout");
if (0 == m_dwKeyboardLayout)
{
//表示不激活任何KeyboardLayout
}
//取出快捷键,采用的是RegisterHotkey的格式。
m_reg.QueryValue(m_dwHotKey, "HotKey");
if ( 0 == m_dwHotKey)
{
//lo-word为Virtual Key Code, hi-word为modifiers
m_dwHotKey = MAKELONG('Q', MOD_CONTROL);
}
//最小化提示标志
m_reg.QueryValue(m_dwStopPromptMin, "StopPromptMin");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -