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

📄 setupdlg.cpp

📁 WinCE下绝好的工具条软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		dwVal |= DISPITEM_SHIFTTITLE ;
	}
	if ( m_opt.bTaskIcon ) {		// 僞僗僋傾僀僐儞
		dwVal |= DISPITEM_TASKICON ;
	}
	if ( m_opt.bNo3D ) {			// 3D傾僀僐儞
		dwVal |= DISPITEM_NO3D ;
	}
	if ( m_opt.bAlways ) {			// 忢偵僗僞乕僩儊僯儏乕傪昞帵
		if ( m_opt.bTitle ) {
			dwVal |= DISPITEM_ALWAYS ;
		}
	}

	m_opt.ico[WIS_ICO_MUTE].bDsp = true;
	m_opt.ico[WIS_ICO_SYSTEM].bDsp = m_opt.bSystem;

	lRet = RegSetValueEx( hKey,REG_DISP_ITEMS,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Notifications
	lRet = RegSetValueEx( hKey,REG_NOTIFY,0,REG_DWORD,(LPBYTE)&m_opt.bNotification, sizeof(m_opt.bNotification) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}
	m_opt.ico[WIS_ICO_NOTIFY].bDsp = m_opt.bNotification;

	// 僞僀僩儖丒僼僅儞僩
	lRet = RegSetValueEx( hKey,REG_TITLE_FONT,0,REG_SZ,(LPBYTE)m_opt.szTitleFont,(lstrlen(m_opt.szTitleFont)+1) * sizeof(TCHAR) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 僞僀僩儖丒僼僅儞僩僒僀僘
	dwVal = (DWORD)m_opt.iTitleSize ;
	lRet = RegSetValueEx( hKey,REG_TITLE_SIZE,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 僞僀僩儖丒僇儔乕
	dwVal = (DWORD)m_opt.crTitle ;
	lRet = RegSetValueEx( hKey,REG_TITLE_CR,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 僞僀僩儖彂懱
	lRet = RegSetValueEx( hKey,REG_TITLE_STYL,0,REG_DWORD,(LPBYTE)&m_opt.dwTitleStyle,sizeof(m_opt.dwTitleStyle) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 帪寁僼僅儞僩
	lRet = RegSetValueEx( hKey,REG_CLOCK_FONT,0,REG_SZ,(LPBYTE)m_opt.szClockFont,(lstrlen(m_opt.szClockFont)+1) * sizeof(TCHAR) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 帪寁僼僅儞僩僒僀僘	
	dwVal = (DWORD)m_opt.iClockSize ;
	lRet = RegSetValueEx( hKey,REG_CLOCK_SIZE,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 帪寁僇儔乕
	dwVal = (DWORD)m_opt.crClock ;
	lRet = RegSetValueEx( hKey,REG_CLOCK_CR,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 帪寁彂懱
	lRet = RegSetValueEx( hKey,REG_CLOCK_STYL,0,REG_DWORD,(LPBYTE)&m_opt.dwClockStyle,sizeof(m_opt.dwClockStyle) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Gradient Titlebar
	lRet = RegSetValueEx( hKey,REG_GRADIENT,0,REG_DWORD,(LPBYTE)&m_opt.bGradient,sizeof(m_opt.bGradient) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	lRet = RegSetValueEx( hKey,REG_DITHERED,0,REG_DWORD,(LPBYTE)&m_opt.bDithered,sizeof(m_opt.bDithered) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Use 2002 Font colors
	lRet = RegSetValueEx( hKey,REG_2002FONTS,0,REG_DWORD,(LPBYTE)&m_opt.use2002FontColors,sizeof(m_opt.use2002FontColors) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Use 2002 Theme colors
	lRet = RegSetValueEx( hKey,REG_2002THEME,0,REG_DWORD,(LPBYTE)&m_opt.b2002Theme,sizeof(m_opt.b2002Theme) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 2002 Style background
	lRet = RegSetValueEx( hKey,REG_2002STYLE,0,REG_DWORD,(LPBYTE)&m_opt.b2002Style,sizeof(m_opt.b2002Style) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Gradient Start Color
	lRet = RegSetValueEx( hKey,REG_GRADSTART,0,REG_DWORD,(LPBYTE)&m_opt.cStartCr,sizeof(m_opt.cStartCr) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Gradient End Color
	lRet = RegSetValueEx( hKey,REG_GRADEND,0,REG_DWORD,(LPBYTE)&m_opt.cEndCr,sizeof(m_opt.cEndCr) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Smart Minimize
	lRet = RegSetValueEx( hKey,REG_SMARTMINIMIZE,0,REG_DWORD,(LPBYTE)&m_opt.bSmartMinimize,sizeof(m_opt.bSmartMinimize) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Compact Date Time
	lRet = RegSetValueEx( hKey,REG_COMPACT,0,REG_DWORD,(LPBYTE)&m_opt.bAMPM,sizeof(m_opt.bAMPM) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Compact Date Time
	lRet = RegSetValueEx( hKey,REG_THMUTE,0,REG_DWORD,(LPBYTE)&m_opt.bTHMUTE,sizeof(m_opt.bTHMUTE) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Hide ActiveSync
	lRet = RegSetValueEx( hKey,REG_HIDEA,0,REG_DWORD,(LPBYTE)&m_opt.bHidea,sizeof(m_opt.bHidea) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Goto today
	lRet = RegSetValueEx( hKey,REG_TODAY,0,REG_DWORD,(LPBYTE)&m_opt.bToday,sizeof(m_opt.bToday) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 3d button
	lRet = RegSetValueEx( hKey,REG_3DBUTTON,0,REG_DWORD,(LPBYTE)&m_opt.b3dbutton,sizeof(m_opt.b3dbutton) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// Tap for Next Appointment
	lRet = RegSetValueEx( hKey,REG_TAPAPPOINT,0,REG_DWORD,(LPBYTE)&m_opt.tapNextAppointment,sizeof(m_opt.tapNextAppointment) );
	if( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 帪寁昞婰
	lRet = RegSetValueEx( hKey,REG_CLOCK_FMT,0,REG_DWORD,(LPBYTE)&m_opt.dwClockFormat,sizeof(m_opt.dwClockFormat) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 擔晅僼僅儞僩
	lRet = RegSetValueEx( hKey,REG_DATE_FONT,0,REG_SZ,(LPBYTE)m_opt.szDateFont,(lstrlen(m_opt.szDateFont)+1) * sizeof(TCHAR) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 擔晅僼僅儞僩僒僀僘	
	dwVal = (DWORD)m_opt.iDateSize ;
	lRet = RegSetValueEx( hKey,REG_DATE_SIZE,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 擔晅僇儔乕
	dwVal = (DWORD)m_opt.crDate ;
	lRet = RegSetValueEx( hKey,REG_DATE_CR,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 擔晅彂懱
	lRet = RegSetValueEx( hKey,REG_DATE_STYL,0,REG_DWORD,(LPBYTE)&m_opt.dwDateStyle,sizeof(m_opt.dwDateStyle) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 彫偝偄擔晅僇儔乕
	dwVal = (DWORD)m_opt.crSmall ;
	lRet = RegSetValueEx( hKey,REG_SM_COLOR,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 僶僢僥儕乕儅乕僋怓
	dwVal = (DWORD)m_opt.crBatt ;
	lRet = RegSetValueEx( hKey,REG_BATT_COLOR,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 儘僑娭楢
	lRet = RegSetValueEx( hKey,REG_LOGO_IMG,0,REG_SZ,(LPBYTE)m_opt.szLogo,(lstrlen(m_opt.szLogo)+1) * sizeof(TCHAR) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 攚宨夋憸
	lRet = RegSetValueEx( hKey,REG_BGIMG_FILE,0,REG_SZ,(LPBYTE)m_opt.szBG,(lstrlen(m_opt.szBG)+1) * sizeof(TCHAR) );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 傾僀僐儞
	for ( int iIdx = 0 ; iIdx < WIS_ICON_NUM ; iIdx++ ) {
		wsprintf( szKey,_T("%s%d"),REG_ICON_KEY,iIdx );

		// 僉乕丒僆乕僾儞
		lRet = RegCreateKeyEx( hKey,szKey,0,_T(""),REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hSubKey,&dwDspOp );
		if ( lRet != ERROR_SUCCESS ) {
			RegCloseKey( hKey );
			return( FALSE );
		}

		// 昞帵偺桳柍
		dwVal = (m_opt.ico[iIdx].bDsp ? 1 : 0);
		lRet = RegSetValueEx( hSubKey,REG_ICON_DISP,0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );
		if ( lRet != ERROR_SUCCESS ) {
			RegCloseKey( hSubKey );
			RegCloseKey( hKey );
			return( FALSE );
		}

		// 僀儊乕僕丒僼傽僀儖
		lRet = RegSetValueEx( hSubKey,REG_ICON_FILE,0,REG_SZ,(LPBYTE)m_opt.ico[iIdx].szIcon,(lstrlen(m_opt.ico[iIdx].szIcon)+1) * sizeof(TCHAR) );
		if ( lRet != ERROR_SUCCESS ) {
			RegCloseKey( hSubKey );
			RegCloseKey( hKey );
			return( FALSE );
		}

		// 僋儘乕僘
		RegCloseKey( hSubKey );
	}

	// 昞帵弴彉
	lRet = RegSetValueEx( hKey,REG_ORDER,0,REG_BINARY,m_opt.cbOrder,ORDER_ID_MAX );
	if ( lRet != ERROR_SUCCESS ) {
		RegCloseKey( hKey );
		return( FALSE );
	}

	// 僋儘乕僘
	RegCloseKey( hKey );

	return( TRUE );
}

/////////////////////////////////////////////////////////////////////////////
// 婯掕抣傪愝掕
void CSetupDlg::FillDefault( LPWISBAR_SETUP_STRUCT lpOpt )
{
	ZeroMemory( lpOpt,sizeof(WISBAR_SETUP_STRUCT) );

	// 僂傿儞僪僂丒僞僀僩儖
	lpOpt->bTitle = TRUE ;						// 昞帵僼儔僌
	lstrcpy( lpOpt->szTitleFont,_T("Tahoma") );	// 僼僅儞僩柤
	lpOpt->iTitleSize = -11 ;					// 僼僅儞僩丒僒僀僘
	lpOpt->crTitle = RGB(255,255,255);			// 暥帤怓
	lpOpt->dwTitleStyle = 1;
	lpOpt->bAlways = FALSE ;					// 忢偵僗僞乕僩儊僯儏乕傪昞帵

	// 帪寁
	lpOpt->bClock = TRUE ;						// 昞帵僼儔僌
	lstrcpy( lpOpt->szClockFont,_T("Tahoma") );	// 僼僅儞僩柤
	lpOpt->iClockSize = -11 ;					// 僼僅儞僩丒僒僀僘
	lpOpt->dwClockStyle = 1 ;					// 僼僅儞僩丒僒僀僘
	lpOpt->crClock = RGB(255,255,255);			// 暥帤怓

	// 擔晅
	lpOpt->bDate = FALSE ;						// 昞帵僼儔僌
	lstrcpy( lpOpt->szDateFont,_T("Tahoma") );	// 僼僅儞僩柤
	lpOpt->iDateSize = -11 ;					// 僼僅儞僩丒僒僀僘
	lpOpt->dwDateStyle = 1 ;					// 僼僅儞僩丒僒僀僘
	lpOpt->crDate = RGB(255,255,255);			// 暥帤怓
	lpOpt->bSmallDate = TRUE;
	lpOpt->bTHMUTE = TRUE;

	// 彫偝偄擔晅
	lpOpt->crSmall = RGB(255,255,255);			// 暥帤怓

	// 僶僢僥儕乕儅乕僋怓
	lpOpt->crBatt = RGB(255,255,255);			// 暥帤怓

	// 僞僗僋丒傾僀僐儞
	lpOpt->bTaskIcon = FALSE ;

	// 儘僑
	lpOpt->bLogo = TRUE ;						// 昞帵僼儔僌
	lpOpt->bShifted = FALSE ;

	// 傾僀僐儞
	lpOpt->ico[WIS_ICO_TODAY].bDsp = TRUE ;
	lpOpt->ico[WIS_ICO_LIST].bDsp = TRUE ;
	lpOpt->ico[WIS_ICO_OK].bDsp = TRUE ;
	lpOpt->ico[WIS_ICO_CLOSE].bDsp = TRUE ;
	lpOpt->ico[WIS_ICO_CLOSE2].bDsp = TRUE ;
	lpOpt->ico[WIS_ICO_NOTIFY].bDsp = FALSE;
	lpOpt->ico[WIS_ICO_OK2].bDsp = TRUE;

	// Defaults
	lpOpt->bSmartMinimize = TRUE;
	lpOpt->bAMPM = TRUE;
	lpOpt->bHidea = FALSE;
	lpOpt->bToday = FALSE;
	lpOpt->bGradient = FALSE;
	lpOpt->bDithered = FALSE;
	lpOpt->b2002Theme = FALSE;
	lpOpt->cStartCr = GetSysColor( COLOR_ACTIVECAPTION );
	lpOpt->cEndCr = GetSysColor( COLOR_ACTIVECAPTION );
	lpOpt->use2002FontColors = FALSE;
	lpOpt->b2002Style = FALSE;
	lpOpt->bNotification = FALSE;
	lpOpt->tapNextAppointment = FALSE;

	// 昞帵弴彉
	for ( int iIdx = 0 ; iIdx < ORDER_ID_MAX ; iIdx++ ) {
		m_opt.cbOrder[iIdx] = (BYTE)iIdx ;
	}
}

/////////////////////////////////////////////////////////////////////////////
// Animated Window
void CSetupDlg::SetAnimated( BOOL bEnable )
{
	HKEY	hKey ;
	LONG	lRet ;
	DWORD	dwVal ;

	// open reg-key
	lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,_T("SYSTEM\\GWE"),0,KEY_ALL_ACCESS,&hKey );
	if ( lRet != ERROR_SUCCESS ) {
		return ;
	}

	// Set
	dwVal = (bEnable ? 1 : 0);
	RegSetValueEx( hKey,_T("Animate"),0,REG_DWORD,(LPBYTE)&dwVal,sizeof(dwVal) );

	RegCloseKey( hKey );
}

/////////////////////////////////////////////////////////////////////////////
// 揔梡
void CSetupDlg::ApplyNow()
{
	// 擖椡抣偺庢傝崬傒
	if ( IsWindow(m_about.m_hWnd) ) {
		m_about.OnApply();
	}
	if ( IsWindow(m_icons.m_hWnd) ) {
		m_icons.OnApply();
	}
	if ( IsWindow(m_imgs.m_hWnd) ) {
		m_imgs.OnApply();
	}
	if ( IsWindow(m_items.m_hWnd) ) {
		m_items.OnApply();
	}
	if ( IsWindow(m_order.m_hWnd) ) {
		m_order.OnApply();
	}
	if ( IsWindow(m_options.m_hWnd) ) {
		m_options.OnApply();
	}
	if( IsWindow(m_icons2.m_hWnd) ) {
		m_icons2.OnApply();
	}

	// 曐懚
	SaveSettings();

	HWND	hWndWis = ::FindWindow( NAV_BAR_CLASS,NULL );
	TCHAR	szClass[32];
	UINT	nCmd = GW_CHILD|GW_HWNDFIRST ;

	while ( hWndWis = ::GetWindow(hWndWis,nCmd) ) {
		::GetClassName( hWndWis,szClass,sizeof(szClass)/sizeof(TCHAR) );
		if ( lstrcmp(WIS_BAR_CLASS,szClass) == 0 ) {
			break ;
		}
		nCmd = GW_HWNDNEXT ;
	}
	if ( !hWndWis ) {
		return ;
	}

	UINT	nMsg = RegisterWindowMessage( MSG_UPDATE_NOTIFY );

	::SendMessage( hWndWis,nMsg,0,0 );
}

/////////////////////////////////////////////////////////////////////////////
// 弶婜壔
BOOL CSetupDlg::OnInitDialog() 
{
	CPropertySheet::OnInitDialog();

/*
	SHINITDLGINFO	shidi ;
	shidi.dwMask = SHIDIM_FLAGS ;
	shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_FULLSCREENNOMENUBAR ;
	shidi.hDlg = m_hWnd ;
	SHInitDialog( &shidi );
*/

	SHMENUBARINFO	cbi ;
	ZeroMemory( &cbi,sizeof(cbi) );
	cbi.cbSize = sizeof(SHMENUBARINFO);
	cbi.hwndParent = m_hWnd ;
	cbi.dwFlags = SHCMBF_EMPTYBAR ;
	SHCreateMenuBar( &cbi );

	return( TRUE );
}

⌨️ 快捷键说明

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