Exemplo n.º 1
0
INT
CAppOptGeneralPage::OnApply()
{
	BOOL fSuccess = FALSE;

	ATLTRACE(_T("CAppOptGeneral::OnApply\n"));

	BOOL fUseDisconnectAlert = (BST_CHECKED == m_wndAlertDisconnect.GetCheck());
	BOOL fUseReconnectAlert = (BST_CHECKED == m_wndAlertReconnect.GetCheck());

	pSetAppConfigValue(_T("UseDisconnectAlert"), fUseDisconnectAlert);
	pSetAppConfigValue(_T("UseReconnectAlert"), fUseReconnectAlert);

	INT nSelItem = m_wndUILangList.GetCurSel();
	DWORD_PTR dwSelLangID = m_wndUILangList.GetItemData(nSelItem);
	if (m_wConfigLangID != (LANGID) dwSelLangID) {

		pSetAppConfigValue(_T("Language"), dwSelLangID);

		CString strTitle, strMessage;
		fSuccess = strTitle.LoadString(IDS_MAIN_TITLE);
		ATLASSERT(fSuccess);
		fSuccess = strMessage.LoadString(IDS_LANGUAGE_CHANGE);
		ATLASSERT(fSuccess);

		(VOID) MessageBox(
			strMessage,
			strTitle,
			MB_OK | MB_ICONINFORMATION);

	}


	return PSNRET_NOERROR;
}
Exemplo n.º 2
0
INT
CAppOptGeneralPage::OnApply()
{
	BOOL fSuccess = FALSE;

	ATLTRACE("CAppOptGeneral::OnApply\n");

	BOOL fUseDisconnectAlert = (BST_CHECKED == m_wndAlertDisconnect.GetCheck());
	BOOL fUseReconnectAlert = (BST_CHECKED == m_wndAlertReconnect.GetCheck());

	pSetAppConfigValue(_T("UseDisconnectAlert"), fUseDisconnectAlert);
	pSetAppConfigValue(_T("UseReconnectAlert"), fUseReconnectAlert);

	if (m_disableAutoPlay != TriStateUnknown)
	{
		TRI_STATE newState = (BST_CHECKED == m_wndDisableAutoPlay.GetCheck()) ?
			TriStateYes : TriStateNo;
		if (m_disableAutoPlay != newState)
		{
			CComPtr<IAutoPlayConfig> pAutoPlayConfig;
			HRESULT hr = CoCreateInstanceAsAdmin(m_hWnd, 
				CLSID_CAutoPlayConfig,
				IID_IAutoPlayConfig,
				(void**) &pAutoPlayConfig);
			if (FAILED(hr))
			{
				ATLTRACE("CoCreateInstanceAsAdmin failed, hr=0x%X\n", hr);
			}
			else
			{
				hr = pAutoPlayConfig->SetNoDriveTypeAutoRun(
					reinterpret_cast<ULONG_PTR>(HKEY_CURRENT_USER),
					AutorunFixedDrive,
					newState == TriStateYes ? AutorunFixedDrive : 0);
				if (FAILED(hr))
				{
					ATLTRACE("IID_IAutoPlayConfig.SetNoDriveTypeAutoRun failed, hr=0x%X\n", hr);
				}
			}
		}
	}

	INT nSelItem = m_wndUILangList.GetCurSel();
	DWORD_PTR dwSelLangID = m_wndUILangList.GetItemData(nSelItem);

	if (m_wConfigLangID != (LANGID) dwSelLangID) 
	{
		pSetAppConfigValue(_T("Language"), (DWORD)dwSelLangID);

		AtlMessageBox(
			m_hWnd, 
			IDS_LANGUAGE_CHANGE, 
			IDS_MAIN_TITLE,
			MB_OK | MB_ICONINFORMATION);
	}

	return PSNRET_NOERROR;
}
Exemplo n.º 3
0
INT_PTR
pShowMessageBox(
	LPCTSTR szMessage, 
	LPCTSTR szTitle,
	HWND hWnd,
	LPCTSTR szDontShowOptionValueName,
	INT_PTR iDefaultButton,
	INT_PTR iDefaultResponse)
{
	CConfirmDlg dlg;

	BOOL fDontShow = FALSE;
	BOOL fSuccess = pGetAppConfigValue(szDontShowOptionValueName,&fDontShow);
	if (fSuccess && fDontShow) {
		return iDefaultResponse;
	}

	dlg.SetMessage(szMessage);
	dlg.SetTitle(szTitle);
	dlg.SetDefaultButton(iDefaultButton);

	INT_PTR iResult = dlg.DoModal();
	fDontShow = dlg.GetDontShow();
	if (fDontShow) {
		fSuccess = pSetAppConfigValue(szDontShowOptionValueName,(BOOL)TRUE);
	}

	return iResult;
}
Exemplo n.º 4
0
static VOID 
pSaveAppOptValues(DWORD nDefs, PAPP_OPT_VALUE_DEF pOptValueDef)
{
	//
	// save changes if the new value and the current values is different
	//
	for (DWORD i = 0; i < nDefs; ++i) {

		PAPP_OPT_VALUE_DEF p = &pOptValueDef[i];

		if (APP_OPT_VALUE_DEF::AOV_BOOL == p->ovType) {

			if (p->CurrentValue.fValue == p->NewValue.fValue) {
				continue;
			}

			(VOID) pSetAppConfigValue(
				p->szValueName, 
				p->NewValue.fValue);

		} else if (APP_OPT_VALUE_DEF::AOV_DWORD == p->ovType) {

			if (p->CurrentValue.dwValue == p->NewValue.dwValue) {
				continue;
			}

			(VOID) pSetAppConfigValue(
				p->szValueName, 
				p->NewValue.dwValue);

		} else {
			// ignore invalid ones
			continue;
		}
	}
}