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

📄 ghdlg.cpp

📁 wince注册表操作
💻 CPP
字号:
// ghDlg.cpp : implementation file
//

#include "stdafx.h"
#include "gh.h"
#include "ghDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL GetRegInfo(HKEY hkeyRoot, LPCTSTR pszPath, LPCTSTR pszKey, LPTSTR psz, size_t cch, LPCTSTR defVal)
{
	
   HKEY hKey = NULL;
   BOOL fSuccess = FALSE;

   if (psz && (0 < cch))
   {
      if (ERROR_SUCCESS == RegOpenKeyEx(hkeyRoot, pszPath, 0, 0, &hKey))
      {
         LPBYTE p = (LPBYTE)(LPCSTR) psz;
         DWORD dw = cch*sizeof(TCHAR);
         if (ERROR_SUCCESS == ::RegQueryValueEx(hKey, pszKey, 0, NULL, p, &dw))
         {
            fSuccess = TRUE;
         }

         ::RegCloseKey(hKey);
      }
   }

   if (!fSuccess)
   {
      if (psz && (0 < cch))
      {
         if (defVal)
         {
            //if (FAILED(StringCchCopy(psz, cch, defVal)))
               *psz = TEXT('\0');
         }
         else
         {
            *psz = TEXT('\0');
         }
      }
   }

   return fSuccess;

}

/////////////////////////////////////////////////////////////////////////////
// CGhDlg dialog

CGhDlg::CGhDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CGhDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGhDlg)
	m_str1 = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CGhDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGhDlg)
	DDX_Text(pDX, IDC_EDIT1, m_str1);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CGhDlg, CDialog)
	//{{AFX_MSG_MAP(CGhDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGhDlg message handlers

BOOL CGhDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen
//mute /enanle tip 
	TCHAR pszValue[256];
	TCHAR pszKey[] = TEXT("ControlPanel\\Volume");
	TCHAR pszValueName1[] = TEXT("Screen");

	CString  strMute;
	//初始化
	strMute=_T("");	//导航软件执行路径

	memset(pszValue,0,256);
	if ( GetRegInfo(HKEY_CURRENT_USER,pszKey,pszValueName1,pszValue,-1,L"8") )
	{

		if ( pszValue[0] == 1  )
				m_str1=_T("1");
		else
			m_str1=_T("0");
	//	strMute.Format(_T("%s"),pszValue);
	}

	UpdateData(FALSE);
	return TRUE;  // return TRUE  unless you set the focus to a control
}


⌨️ 快捷键说明

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