📄 setszvalue.cpp
字号:
// SetSZValue.cpp : implementation file
//
#include "stdafx.h"
#include "RegEdit.h"
#include "SetSZValue.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetSZValue dialog
CSetSZValue::CSetSZValue(CWnd* pParent /*=NULL*/)
: CDialog(CSetSZValue::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetSZValue)
m_Name = _T("");
m_Value = _T("");
//}}AFX_DATA_INIT
}
void CSetSZValue::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetSZValue)
DDX_Text(pDX, IDC_EDIT_NAME, m_Name);
DDX_Text(pDX, IDC_EDIT_VALUE, m_Value);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetSZValue, CDialog)
//{{AFX_MSG_MAP(CSetSZValue)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetSZValue message handlers
void CSetSZValue::Disp(HKEY hKey, CString strName, CString strValue)
{
m_Name=strName;
m_Value=strValue;
h_Key=hKey;
DoModal ();
}
void CSetSZValue::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
// MessageBox(m_Value,NULL,MB_OK);
if(ERROR_SUCCESS!=RegSetValueEx(h_Key,(LPCTSTR)m_Name,NULL,REG_SZ,(CONST BYTE *)(LPCTSTR)m_Value,m_Value.GetLength()*2 ))
MessageBox(_T("设置值失败!"),_T("失败"),MB_OK);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -