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

📄 properties.cpp

📁 teamviewer source code vc++
💻 CPP
📖 第 1 页 / 共 4 页
字号:
//  Copyright (C) 2006 Teamviewer GmbH. All Rights Reserved.
//
//  This file is part of TeamViewer.
//
//  TeamViewer is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
//  USA.
//

// vncProperties.cpp
// Implementation of the Properties dialog

#include "stdhdrs.h"
#include "vncService.h"
#include "properties.h"
#include "vncServer.h"
#include "vncPasswd.h"
#include "vncOSVersion.h"
#include "vncMenu.h"
#include "../../vncviewer/CustomSettings.h"
#include "../../vncviewer/SessionDialog.h"
#include "localization.h" 
#include "global.h" 

vncProperties* vncProperties::singleton;
const char TV_REGISTRY_KEY [] = "Software\\TeamViewer";

extern bool isQuickSupport;
bool RunningAsAdministrator();



// Constructor & Destructor
vncProperties::vncProperties()
{
	Lock_service_helper=true;
	singleton = this;
	m_Properties_Location = 0;
}

vncProperties::~vncProperties()
{
	SecureZeroMemory(m_pref_Host_Passwd,sizeof(m_pref_Host_Passwd));
	singleton=NULL;

	
}

// Initialisation
BOOL vncProperties::Init(vncServer *server)
{
	m_server = server;
	ResetProperties();
	Load();
	Save();
	return TRUE;
}

void vncProperties::ResetProperties()
{
	SetConnectionMode(Teamwork);

	// General properties
	m_pref_General_UseDynGate = true;
	m_pref_General_Identity[0] = '\0';
	m_pref_General_ConnectionLogging = !isNoSave && !isQuickSupport;
	m_pref_General_Logging = false;

	// Remote control properties
	m_pref_Remote_Quality = 0;
	m_pref_Remote_Compression = 2;
	m_pref_Remote_Colors = rfbPFFullColors;
	m_pref_Remote_ServerScale = 1;
	m_pref_Remote_ViewOnly = false;
	m_pref_Remote_Wallpaper = false;
	m_pref_Remote_DisableInput = false;
	m_pref_Remote_BlackScreen = false;
	m_pref_Remote_Scaling = true;
	m_pref_Remote_Autoscaling = true;
	m_pref_Remote_ScaleBy = 100;
	m_pref_Remote_ShowRemoteCursor = true;

	// Presentation properties
	m_pref_Presentation_Quality = 0;
	m_pref_Presentation_Compression = 2;
	m_pref_Presentation_Colors = rfbPFFullColors;
	m_pref_Presentation_ServerScale = 1;
	m_pref_Presentation_SingleWindow = false;
	m_pref_Presentation_WindowNamed[0] = '\0';
	m_pref_Presentation_Wallpaper = false;
	

	// Security properties
	m_pref_Security_AdminOnly = false;
	m_pref_Security_AllowIncoming = true;
	m_pref_Security_AllowDisableInput = true;
	m_pref_Security_AllowInput = true;
	m_pref_Security_EnableFileTransfer = 2;
	m_pref_Security_LockSettings = 0;
	m_pref_Security_Multiple = 0;
	m_pref_Security_SingleWindow = false;
	m_pref_Security_ShareWindowNamed[0] = '\0';
#ifdef _DEBUG
	m_pref_Security_VNC_Compat = true;
#else 
	m_pref_Security_VNC_Compat = false;
#endif

	m_pref_CustomInvitation_Subject[0] = '\0';
	m_pref_CustomInvitation_Text[0] = '\0';
	// Host properties
	m_pref_Host_AllowShutdown = true;
	m_pref_Host_Autostart = 0;
	vncPasswd::FromClear crypt;
	memcpy(m_pref_Host_Passwd, crypt, MAXPWLEN);

	Lock_service_helper=false;
	m_dlgvisible = false;
}

// Dialog box handling functions
void vncProperties::ShowAdmin(BOOL show, BOOL usersettings,int startPage)
{
	if (show)
	{
		// Now, if the dialog is not already displayed, show it!
		if (!m_dlgvisible)
		{
			isAdmin = RunningAsAdministrator();
			m_dlgvisible = true;
			int result = ShowPropertiesDialog(startPage);
			m_dlgvisible = false;
		}
	}
}

//Initialize General settings tab
void vncProperties::InitGeneralDialog(HWND hGeneral)
{
	// Use DynGate checkbox and button
	CheckDlgButton(hGeneral, IDC_USE_DYNGATE, m_pref_General_UseDynGate);
	EnableWindow(GetDlgItem(hGeneral, IDC_BUTTON_DYNGATEOPTIONS), m_pref_General_UseDynGate);

	// Identity editbox	
	if(strlen(m_pref_General_Identity))
		SetDlgItemText(hGeneral, IDC_IDENTITY, m_pref_General_Identity);
	else
		SetDlgItemText(hGeneral, IDC_IDENTITY, sz_IDS_USER_IDENTITY_TEMPLATE);

	// Logging checkboxes
	CheckDlgButton(hGeneral, IDC_LOGGING, m_pref_General_Logging);
	CheckDlgButton(hGeneral, IDC_CONNECTION_LOGGING, m_pref_General_ConnectionLogging);

	helptexts[GetDlgItem(hGeneral, IDC_USE_DYNGATE)] = sz_IDS_HELP_USEDYNGATE;
	helptexts[GetDlgItem(hGeneral, IDC_LOGGING)] = sz_IDS_HELP_LOGFILE;
	helptexts[GetDlgItem(hGeneral, IDC_CONNECTION_LOGGING)] = sz_IDS_HELP_CONNECTIONLOG;
	helptexts[GetDlgItem(hGeneral, IDC_IDENTITY)] = sz_IDS_HELP_IDENTITY;

	HWND label = GetDlgItem(hGeneral, IDC_GENERAL_HELPTEXT);
	WNDPROC oldHelpLabelProc = (WNDPROC) SetWindowLong(label, GWL_WNDPROC, (LONG)HelpTextProc);
	SetWindowLong(label, GWL_USERDATA, (LONG)oldHelpLabelProc);	
}

//Initialize Remotecontrol settings tab
void vncProperties::InitRemoteDialog(HWND hRemote)
{
	// Quality settings
	HWND hDisplayQuality = GetDlgItem(hRemote, IDC_REMOTE_QUALITY);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_AUTOMATIC_QUALITY_SELECTION);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_OPTIMIZE_QUALITY);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_OPTIMIZE_SPEED);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_CUSTOM_QUALITY);
	SendMessage(hDisplayQuality, CB_SETCURSEL,  m_pref_Remote_Quality, 0);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_CUSTOM), m_pref_Remote_Quality == 3);

	// checkboxes
	SetDlgItemInt(hRemote, IDC_REMOTE_SCALE, m_pref_Remote_ServerScale, FALSE);
	CheckDlgButton(hRemote, IDC_REMOTE_VIEWONLY, m_pref_Remote_ViewOnly);
	CheckDlgButton(hRemote, IDC_REMOTE_DINPUT, m_pref_Remote_DisableInput);
	CheckDlgButton(hRemote, IDC_REMOTE_BLACKSCREEN, m_pref_Remote_BlackScreen);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_BLACKSCREEN), m_pref_Remote_DisableInput);
	
	// scaling
	CheckDlgButton(hRemote, IDC_REMOTE_SCALING, m_pref_Remote_Scaling);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_AUTOSCALING), m_pref_Remote_Scaling);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_SCALE_CONSTANT), m_pref_Remote_Scaling);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_SCALEBY), m_pref_Remote_Scaling && !m_pref_Remote_Autoscaling);
	EnableWindow(GetDlgItem(hRemote, IDC_REMOTE_SCALE_LABEL), m_pref_Remote_Scaling && !m_pref_Remote_Autoscaling);
	CheckDlgButton(hRemote, IDC_REMOTE_AUTOSCALING, m_pref_Remote_Autoscaling);
	CheckDlgButton(hRemote, IDC_REMOTE_SCALE_CONSTANT, !m_pref_Remote_Autoscaling);

	CheckDlgButton(hRemote, IDC_SHOWREMOTECURSOR, m_pref_Remote_ShowRemoteCursor);

	

	AddDefaultScalings(GetDlgItem(hRemote, IDC_REMOTE_SCALEBY));
	SetDlgItemInt(hRemote, IDC_REMOTE_SCALEBY, m_pref_Remote_ScaleBy, FALSE);

	HWND label = GetDlgItem(hRemote, IDC_REMOTE_HELPTEXT);
	WNDPROC oldHelpLabelProc = (WNDPROC) SetWindowLong(label, GWL_WNDPROC, (LONG)HelpTextProc);
	SetWindowLong(label, GWL_USERDATA, (LONG)oldHelpLabelProc);

	helptexts[hDisplayQuality] = sz_IDS_HELP_REMOTE_QUALITY;  
	helptexts[GetDlgItem(hRemote, IDC_REMOTE_QUALITYLABEL)] = sz_IDS_HELP_REMOTE_QUALITY;   
	helptexts[GetDlgItem(hRemote, IDC_REMOTE_SCALE)] = sz_IDS_HELP_REMOTE_SERVERSCALE;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_SCALELABEL)] = sz_IDS_HELP_REMOTE_SERVERSCALE;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_VIEWONLY)] = sz_IDS_HELP_REMOTE_VIEWONLY;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_DINPUT)] = sz_IDS_HELP_REMOTE_DINPUT;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_BLACKSCREEN)] = sz_IDS_HELP_REMOTE_BLACK;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_SCALING)] = sz_IDS_HELP_REMOTE_SCALING;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_AUTOSCALING)] = sz_IDS_HELP_REMOTE_AUTOSCALING;
	helptexts[GetDlgItem(hRemote, IDC_SHOWREMOTECURSOR)] = sz_IDS_HELP_REMOTE_SHOWREMOTECURSOR;

    helptexts[GetDlgItem(hRemote, IDC_REMOTE_SCALE_CONSTANT)] = sz_IDS_HELP_REMOTE_CONSTSCALING;
    helptexts[GetDlgItem(hRemote, IDC_REMOTE_SCALEBY)] = sz_IDS_HELP_REMOTE_CONSTSCALING;
}

//Initialize Presentation settings tab
void vncProperties::InitPresentationDialog(HWND hPres)
{
	HWND hDisplayQuality = GetDlgItem(hPres, IDC_PRES_QUALITY);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_AUTOMATIC_QUALITY_SELECTION);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_OPTIMIZE_QUALITY);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_OPTIMIZE_SPEED);
	SendMessage(hDisplayQuality, CB_ADDSTRING, 0, (LPARAM)sz_IDS_CUSTOM_QUALITY);
	SendMessage(hDisplayQuality, CB_SETCURSEL,  m_pref_Presentation_Quality, 0);
	EnableWindow(GetDlgItem(hPres, IDC_PRES_CUSTOM), m_pref_Presentation_Quality == 3);
	SetDlgItemInt(hPres, IDC_PRES_SERVERSCALE, m_pref_Presentation_ServerScale, FALSE);
	
	// show single window
	CheckDlgButton(hPres, IDC_PRES_SINGLE_WINDOW, m_pref_Presentation_SingleWindow);
	EnableWindow(GetDlgItem(hPres, IDC_PRES_WINDOWNAMED), m_pref_Presentation_SingleWindow);
	SetDlgItemText(hPres, IDC_PRES_WINDOWNAMED, m_pref_Presentation_WindowNamed);

	HWND label = GetDlgItem(hPres, IDC_PRES_HELPTEXT);
	WNDPROC oldHelpLabelProc = (WNDPROC) SetWindowLong(label, GWL_WNDPROC, (LONG)HelpTextProc);
	SetWindowLong(label, GWL_USERDATA, (LONG)oldHelpLabelProc);
	helptexts[hDisplayQuality] =  sz_IDS_HELP_PRES_QUALITY;
	helptexts[GetDlgItem(hPres,IDC_PRES_QUALITYLABEL)] =  sz_IDS_HELP_PRES_QUALITY;
	helptexts[GetDlgItem(hPres,IDC_PRES_SERVERSCALE)] = sz_IDS_HELP_PRES_SERVERSCALE;
	helptexts[GetDlgItem(hPres,IDC_PRES_SERVERSCALELABEL)] = sz_IDS_HELP_PRES_SERVERSCALE;
	helptexts[GetDlgItem(hPres,IDC_PRES_SINGLE_WINDOW)] = sz_IDS_HELP_PRES_SINGLEWINDOW;
	helptexts[GetDlgItem(hPres,IDC_PRES_WINDOWNAMED)] = sz_IDS_HELP_PRES_SINGLEWINDOW;
}

void vncProperties::InitInvitationDialog(HWND hInvitation)
{
	ConvertHTML2CInvitation();


	SetDlgItemText(hInvitation,IDC_SUBJECTEDIT,m_pref_CustomInvitation_Subject.c_str());
	SetDlgItemText(hInvitation,IDC_EDITINVITATION,m_pref_CustomInvitation_Text.c_str());
	
	SendDlgItemMessage(hInvitation,IDC_SUBJECTEDIT,EM_LIMITTEXT,MAX_SUBJECT_STRING_LEN,0);
	SendDlgItemMessage(hInvitation,IDC_EDITINVITATION,EM_LIMITTEXT,MAX_INVITATION_TEXT_LEN,0);

	helptexts[GetDlgItem(hInvitation, IDC_SUBJECTEDIT)] = "";
	helptexts[GetDlgItem(hInvitation, IDC_EDITINVITATION)] = "";

	ApplyInvitation(hInvitation);
	
}

//Initialize Security settings tab
void vncProperties::InitSecurityDialog(HWND hSecurity)
{
	// checkboxes
	CheckDlgButton(hSecurity, IDC_SECURITY_ADMIN, m_pref_Security_AdminOnly);
	EnableWindow(GetDlgItem(hSecurity, IDC_SECURITY_ADMIN), isAdmin);

	CheckDlgButton(hSecurity, IDC_SECURITY_INCOMING, m_pref_Security_AllowIncoming);
	CheckDlgButton(hSecurity, IDC_SECURITY_DINPUT, m_pref_Security_AllowDisableInput);
	CheckDlgButton(hSecurity, IDC_SECURITY_ALLOW_INPUT, m_pref_Security_AllowInput);
	CheckDlgButton(hSecurity, IDC_SECURITY_FILETRANSFER, m_pref_Security_EnableFileTransfer);
	EnableWindow(GetDlgItem(hSecurity, IDC_FTRANS_NOQUERY), m_pref_Security_EnableFileTransfer);
	EnableWindow(GetDlgItem(hSecurity, IDC_FTRANS_QUERY), m_pref_Security_EnableFileTransfer);
	CheckDlgButton(hSecurity, IDC_FTRANS_NOQUERY, m_pref_Security_EnableFileTransfer == 1);
	CheckDlgButton(hSecurity, IDC_FTRANS_QUERY, m_pref_Security_EnableFileTransfer == 2);
	CheckDlgButton(hSecurity, IDC_SECURITY_VNC_COMPAT, m_pref_Security_VNC_Compat);

	// 'after finishing last session'
	HWND hAfterLastSession = GetDlgItem(hSecurity, IDC_AFTER_LAST_SESSION);
	SendMessage(hAfterLastSession, CB_ADDSTRING, 0, (LPARAM)sz_IDS_LAST_SESSION_NO_ACTION);
  	SendMessage(hAfterLastSession, CB_ADDSTRING, 0, (LPARAM)sz_IDS_LAST_SESSION_LOCK_WORKSTATION);
  	SendMessage(hAfterLastSession, CB_ADDSTRING, 0, (LPARAM)sz_IDS_LAST_SESSION_LOG_OFF_USER);
	SendMessage(hAfterLastSession, CB_SETCURSEL,
		m_pref_Security_LockSettings==-1 ? 0:m_pref_Security_LockSettings, 0); 

	// 'multiple connections'
	HWND hMultipleConnections = GetDlgItem(hSecurity, IDC_SECURITY_MULTIPLE);
	SendMessage(hMultipleConnections, CB_RESETCONTENT, 30, 0);
	SendMessage(hMultipleConnections, CB_ADDSTRING, 0, (LPARAM)sz_IDS_MULTIPLE_CONNECTIONS_STOP);
  	SendMessage(hMultipleConnections, CB_ADDSTRING, 0, (LPARAM)sz_IDS_MULTIPLE_CONNECTIONS_DONT_STOP);
  	SendMessage(hMultipleConnections, CB_ADDSTRING, 0, (LPARAM)sz_IDS_MULTIPLE_CONNECTIONS_REJECT);
	SendMessage(hMultipleConnections, CB_SETCURSEL, m_pref_Security_Multiple, 0); 
	
	// 'share only the window named'
	CheckDlgButton(hSecurity, IDC_SINGLE_WINDOW, m_pref_Security_SingleWindow);
	EnableWindow(GetDlgItem(hSecurity, IDC_NAME_APPLI), m_pref_Security_SingleWindow);
	SetDlgItemText(hSecurity, IDC_NAME_APPLI, m_pref_Security_ShareWindowNamed);

	HWND label = GetDlgItem(hSecurity, IDC_SECURITY_HELPTEXT);
	WNDPROC oldHelpLabelProc = (WNDPROC) SetWindowLong(label, GWL_WNDPROC, (LONG)HelpTextProc);
	SetWindowLong(label, GWL_USERDATA, (LONG)oldHelpLabelProc);
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_ADMIN)] = sz_IDS_HELP_SEC_ADMIN;
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_INCOMING)] = sz_IDS_HELP_SEC_ACCEPTINCOMING;
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_DINPUT)] = sz_IDS_HELP_SEC_DINPUT_ALLOWED;
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_ALLOW_INPUT)] = sz_IDS_HELP_SEC_ALLOWINPUT;
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_FILETRANSFER)] = sz_IDS_HELP_SEC_ALLOWFILETRANS;
	helptexts[GetDlgItem(hSecurity, IDC_FTRANS_NOQUERY)] = sz_IDS_HELP_SEC_ALLOWFILETRANS;
	helptexts[GetDlgItem(hSecurity, IDC_FTRANS_QUERY)] = sz_IDS_HELP_SEC_ALLOWFILETRANS;
	helptexts[hAfterLastSession] = sz_IDS_HELP_SEC_AFTERLAST;
	helptexts[hMultipleConnections] = sz_IDS_HELP_SEC_MULTIPLE;
	helptexts[GetDlgItem(hSecurity, IDC_SINGLE_WINDOW)] = sz_IDS_HELP_SEC_SINGLEWINDOW;
	helptexts[GetDlgItem(hSecurity, IDC_NAME_APPLI)] = sz_IDS_HELP_SEC_SINGLEWINDOW;
	helptexts[GetDlgItem(hSecurity, IDC_SECURITY_VNC_COMPAT)] = sz_IDS_HELP_SEC_VNCCOMPAT;
}

//Initialize Host settings tab
void vncProperties::InitHostDialog(HWND hHost)
{
	CheckDlgButton(hHost,IDC_HOST_SERVER_MODE, m_pref_Host_Autostart > 0);
	EnableServerMode(hHost, m_pref_Host_Autostart > 0);
	vncPasswd::ToText unenc(m_pref_Host_Passwd);
	SetDlgItemText(hHost, IDC_HOST_PASSWORD, unenc);
	SetDlgItemText(hHost, IDC_HOST_PASSWORD2, unenc);

	switch(m_pref_Host_Autostart)
	{
		case 3:
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART, BST_UNCHECKED);	
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART_SERVICE, BST_UNCHECKED);	
			break;
		case 2:
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART, BST_UNCHECKED);	
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART_SERVICE, BST_CHECKED);	
			break;
		case 1:
		case 0:
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART, BST_CHECKED);	
			CheckDlgButton(hHost, IDC_HOST_AUTOSTART_SERVICE, BST_UNCHECKED);	
			break;
	}

	CheckDlgButton(hHost, IDC_HOST_DISABLESHUTDOWN, !m_pref_Host_AllowShutdown);

	HWND label = GetDlgItem(hHost, IDC_HOST_HELPTEXT);
	WNDPROC oldHelpLabelProc = (WNDPROC) SetWindowLong(label, GWL_WNDPROC, (LONG)HelpTextProc);
	SetWindowLong(label, GWL_USERDATA, (LONG)oldHelpLabelProc);
	helptexts[GetDlgItem(hHost,IDC_HOST_SERVER_MODE)] = sz_IDS_HELP_HOST_USEHOSTMODE;
	helptexts[GetDlgItem(hHost,IDC_HOST_AUTOSTART)] = sz_IDS_HELP_HOST_AUTOSTART;
	helptexts[GetDlgItem(hHost,IDC_HOST_AUTOSTART_SERVICE)] = sz_IDS_HELP_HOST_SERVICE;
	helptexts[GetDlgItem(hHost,IDC_HOST_DISABLESHUTDOWN)] = sz_IDS_HELP_HOST_SHUTDOWN;
	helptexts[GetDlgItem(hHost,IDC_HOST_PASSWORD)] = sz_IDS_HELP_HOST_PASSWORD;
	helptexts[GetDlgItem(hHost,IDC_HOST_PASSWORD2)] = sz_IDS_HELP_HOST_PASSWORD2;
	helptexts[GetDlgItem(hHost,IDC_HOST_PASSWORDLABEL)] = sz_IDS_HELP_HOST_PASSWORD;
}


LONG vncProperties::ApplyGeneral(HWND hGeneral)
{
	m_pref_General_UseDynGate = IsDlgButtonChecked(hGeneral, IDC_USE_DYNGATE);

	char identity[MAXIDENTITYLEN];
	int len = GetDlgItemText(hGeneral, IDC_IDENTITY, (LPSTR) &identity, MAXIDENTITYLEN);
	if(strncmp(identity, sz_IDS_USER_IDENTITY_TEMPLATE, MAXIDENTITYLEN) == 0)
		m_pref_General_Identity[0] = '\0';
	else
		strncpy(m_pref_General_Identity, identity, MAXIDENTITYLEN);
	m_pref_General_Identity[MAXIDENTITYLEN] = '\0';

	m_pref_General_Logging = IsDlgButtonChecked(hGeneral, IDC_LOGGING);
	m_pref_General_ConnectionLogging = IsDlgButtonChecked(hGeneral, IDC_CONNECTION_LOGGING);

	return PSNRET_NOERROR;
}

LONG vncProperties::VerifyRemote(HWND hRemote)
{
	int serverScale = GetDlgItemInt(hRemote, IDC_REMOTE_SCALE, NULL, FALSE);
	if(serverScale < 1 || serverScale > 9)
	{
		MessageBox(NULL,
			"Server scaling factor can only be in the range of 1 to 9.", NULL, 0);
		return PSNRET_INVALID_NOCHANGEPAGE;
	}
	return PSNRET_NOERROR;
}

LONG vncProperties::ApplyRemote(HWND hRemote)
{
	int serverScale = GetDlgItemInt(hRemote, IDC_REMOTE_SCALE, NULL, FALSE);

	m_pref_Remote_Quality = SendMessage(GetDlgItem(hRemote, IDC_REMOTE_QUALITY), CB_GETCURSEL, 0, 0);
	m_pref_Remote_ServerScale = serverScale;

	m_pref_Remote_ViewOnly = IsDlgButtonChecked(hRemote, IDC_REMOTE_VIEWONLY);
	m_pref_Remote_DisableInput = IsDlgButtonChecked(hRemote, IDC_REMOTE_DINPUT);
	m_pref_Remote_BlackScreen = IsDlgButtonChecked(hRemote, IDC_REMOTE_BLACKSCREEN);
	
	m_pref_Remote_Scaling = IsDlgButtonChecked(hRemote, IDC_REMOTE_SCALING);
	m_pref_Remote_Autoscaling = IsDlgButtonChecked(hRemote, IDC_REMOTE_AUTOSCALING);
	m_pref_Remote_ScaleBy = GetDlgItemInt(hRemote, IDC_REMOTE_SCALEBY, NULL, FALSE);

	m_pref_Remote_ShowRemoteCursor = IsDlgButtonChecked(hRemote, IDC_SHOWREMOTECURSOR);

	return PSNRET_NOERROR;
}

LONG vncProperties::VerifyPresentation(HWND hPres)
{
	int serverScale = GetDlgItemInt(hPres, IDC_PRES_SERVERSCALE, NULL, FALSE);
	if(serverScale < 1 || serverScale > 9)
	{
		MessageBox(NULL,
			"Server scaling factor can only be in the range of 1 to 9.", NULL, 0);
		return PSNRET_INVALID_NOCHANGEPAGE;
	}
	return PSNRET_NOERROR;
}

LONG vncProperties::ApplyPresentation(HWND hPres)
{	
	m_pref_Presentation_Quality = SendMessage(GetDlgItem(hPres, IDC_PRES_QUALITY), CB_GETCURSEL, NULL, 0);
	m_pref_Presentation_ServerScale = GetDlgItemInt(hPres, IDC_PRES_SERVERSCALE, NULL, FALSE);
	
	m_pref_Presentation_SingleWindow = IsDlgButtonChecked(hPres, IDC_PRES_SINGLE_WINDOW);

	GetDlgItemText(hPres, IDC_PRES_WINDOWNAMED, (LPSTR) &m_pref_Presentation_WindowNamed, MAX_SW_NAMELEN);

	return PSNRET_NOERROR;
}

LONG vncProperties::ApplySecurity(HWND hSecurity)
{
	m_pref_Security_AdminOnly = IsDlgButtonChecked(hSecurity, IDC_SECURITY_ADMIN);
	m_pref_Security_AllowIncoming = IsDlgButtonChecked(hSecurity, IDC_SECURITY_INCOMING);
	m_pref_Security_AllowDisableInput = IsDlgButtonChecked(hSecurity, IDC_SECURITY_DINPUT);
	m_pref_Security_AllowInput = IsDlgButtonChecked(hSecurity, IDC_SECURITY_ALLOW_INPUT);
	m_pref_Security_VNC_Compat = IsDlgButtonChecked(hSecurity, IDC_SECURITY_VNC_COMPAT);

⌨️ 快捷键说明

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