📄 properties.cpp
字号:
vncProperties::singleton->InitGeneralDialog(hwnd);
return TRUE;
case WM_TIMER:
TimerProc(hwnd, IDC_GENERAL_HELPTEXT);
break;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, NULL, &(vncProperties::ApplyGeneral));
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_USE_DYNGATE:
{
BOOL usedyngate = (SendMessage(GetDlgItem(hwnd,IDC_USE_DYNGATE),BM_GETCHECK,0,0)==BST_CHECKED);
EnableWindow(GetDlgItem(hwnd,IDC_BUTTON_DYNGATEOPTIONS), usedyngate);
break;
}
case IDC_BUTTON_DYNGATEOPTIONS:
{
CroGateway *rgw = CroGateway::Instance();
rgw->ShowOptions();
break;
}
}
}
break;
case WM_DESTROY:
KillTimer(hwnd, 1);
return 0;
}
return (FALSE);
}
BOOL APIENTRY vncProperties::RemoteProc(
HWND hwnd,
UINT message,
UINT wParam,
LONG lParam)
{
switch (message)
{
case WM_INITDIALOG:
vncProperties::singleton->InitRemoteDialog(hwnd);
return TRUE;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, &(vncProperties::VerifyRemote), &(vncProperties::ApplyRemote));
case WM_TIMER:
TimerProc(hwnd, IDC_REMOTE_HELPTEXT);
break;
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_REMOTE_QUALITY:
{
int quality = SendMessage(GetDlgItem(hwnd, IDC_REMOTE_QUALITY),
CB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_CUSTOM), quality == 3);
//vncProperties::singleton->ApplyQuality(
// quality,
// &(vncProperties::singleton->m_pref_Remote_Compression),
// &(vncProperties::singleton->m_pref_Remote_Colors),
// &(vncProperties::singleton->m_pref_Remote_Wallpaper));
break;
}
case IDC_REMOTE_CUSTOM:
{
CustomSettings cs;
cs.SetCompression(vncProperties::singleton->m_pref_Remote_Compression);
cs.SetColorDepth(vncProperties::singleton->m_pref_Remote_Colors);
cs.SetRemoveWallpaper(vncProperties::singleton->m_pref_Remote_Wallpaper);
if(cs.DoDialog(hwnd))
{
vncProperties::singleton->m_pref_Remote_Compression = cs.GetCompression();
vncProperties::singleton->m_pref_Remote_Colors = cs.GetColorDepth();
vncProperties::singleton->m_pref_Remote_Wallpaper = cs.GetRemoveWallpaper();
}
}
case IDC_REMOTE_DINPUT:
{
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_BLACKSCREEN),
IsDlgButtonChecked(hwnd, IDC_REMOTE_DINPUT));
break;
}
case IDC_REMOTE_SCALING:
{
UINT scaling = IsDlgButtonChecked(hwnd, IDC_REMOTE_SCALING) > 0;
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_AUTOSCALING), scaling);
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_SCALE_CONSTANT), scaling);
UINT autoscaling = IsDlgButtonChecked(hwnd, IDC_REMOTE_AUTOSCALING) > 0;
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_SCALEBY), scaling && !autoscaling);
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_SCALE_LABEL), scaling && !autoscaling);
break;
}
case IDC_REMOTE_AUTOSCALING:
case IDC_REMOTE_SCALE_CONSTANT:
{
UINT autoscaling = IsDlgButtonChecked(hwnd, IDC_REMOTE_AUTOSCALING) > 0;
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_SCALEBY), !autoscaling);
EnableWindow(GetDlgItem(hwnd, IDC_REMOTE_SCALE_LABEL), !autoscaling);
break;
}
}
}
}
return (FALSE);
}
BOOL APIENTRY vncProperties::PresentationProc(
HWND hwnd,
UINT message,
UINT wParam,
LONG lParam)
{
switch (message)
{
case WM_INITDIALOG:
vncProperties::singleton->InitPresentationDialog(hwnd);
return (TRUE);
case WM_TIMER:
TimerProc(hwnd, IDC_PRES_HELPTEXT);
break;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, &(vncProperties::VerifyPresentation), &(vncProperties::ApplyPresentation));
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_PRES_QUALITY:
{
int quality = SendMessage(GetDlgItem(hwnd, IDC_PRES_QUALITY),
CB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_PRES_CUSTOM), quality == 3);
//vncProperties::singleton->ApplyQuality(
// quality,
// &(vncProperties::singleton->m_pref_Presentation_Encoding),
// &(vncProperties::singleton->m_pref_Presentation_Colors),
// &(vncProperties::singleton->m_pref_Presentation_Wallpaper));
break;
}
case IDC_PRES_CUSTOM:
{
CustomSettings cs;
cs.SetCompression(vncProperties::singleton->m_pref_Presentation_Compression);
cs.SetColorDepth(vncProperties::singleton->m_pref_Presentation_Colors);
cs.SetRemoveWallpaper(vncProperties::singleton->m_pref_Presentation_Wallpaper);
if(cs.DoDialog(hwnd))
{
vncProperties::singleton->m_pref_Presentation_Compression = cs.GetCompression();
vncProperties::singleton->m_pref_Presentation_Colors = cs.GetColorDepth();
vncProperties::singleton->m_pref_Presentation_Wallpaper = cs.GetRemoveWallpaper();
}
}
case IDC_PRES_SINGLE_WINDOW:
{
EnableWindow(GetDlgItem(hwnd, IDC_PRES_WINDOWNAMED),
IsDlgButtonChecked(hwnd, IDC_PRES_SINGLE_WINDOW));
break;
}
}
}
break;
}
return (FALSE);
}
BOOL APIENTRY vncProperties::InviteProc(
HWND hwnd,
UINT message,
UINT wParam,
LONG lParam)
{
BOOL res = FALSE;
switch (message)
{
case WM_INITDIALOG:
vncProperties::singleton->InitInvitationDialog(hwnd);
return (TRUE);
case WM_TIMER:
TimerProc(hwnd, IDC_PRES_HELPTEXT);
break;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, /*&(vncProperties::VerifyPresentation)*/NULL, &(vncProperties::ApplyInvitation));
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_TESTINVITATION:
{
if (MessageBox(hwnd,sz_IDS_TEST_INVITATION,sz_IDS_CONFIRMATION,MB_ICONQUESTION | MB_YESNO) != IDYES)
break;
vncProperties::singleton->ApplyInvitation(hwnd);
SessionDialog::InvitePartner();
res = PropSheet_Apply(GetParent(hwnd));
break;
}
case IDC_RESETINVITATION:
{
if (MessageBox(hwnd,sz_IDS_RESET_INVITATION,sz_IDS_CONFIRMATION,MB_ICONQUESTION | MB_YESNO) != IDYES)
break;
SetDlgItemText(hwnd,IDC_SUBJECTEDIT,"");
SetDlgItemText(hwnd,IDC_EDITINVITATION,"");
vncProperties::singleton->ApplyInvitation(hwnd);
res = PropSheet_Apply(GetParent(hwnd));
break;
}
}
}
break;
}
return (FALSE);
}
BOOL APIENTRY vncProperties::SecurityProc(
HWND hwnd,
UINT message,
UINT wParam,
LONG lParam)
{
switch (message)
{
case WM_INITDIALOG:
vncProperties::singleton->InitSecurityDialog(hwnd);
return TRUE;
case WM_TIMER:
TimerProc(hwnd, IDC_SECURITY_HELPTEXT);
break;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, NULL, &(vncProperties::ApplySecurity));
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_SECURITY_FILETRANSFER:
{
BOOL checked = IsDlgButtonChecked(hwnd, IDC_SECURITY_FILETRANSFER);
EnableWindow(GetDlgItem(hwnd, IDC_FTRANS_QUERY), checked);
EnableWindow(GetDlgItem(hwnd, IDC_FTRANS_NOQUERY), checked);
if(checked)
{
CheckDlgButton(hwnd, IDC_FTRANS_NOQUERY, BST_CHECKED);
CheckDlgButton(hwnd, IDC_FTRANS_QUERY, BST_UNCHECKED);
}
else
{
CheckDlgButton(hwnd, IDC_FTRANS_NOQUERY, BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_FTRANS_QUERY, BST_UNCHECKED);
}
break;
}
case IDC_SINGLE_WINDOW:
{
EnableWindow(GetDlgItem(hwnd, IDC_NAME_APPLI),
IsDlgButtonChecked(hwnd, IDC_SINGLE_WINDOW));
break;
}
}
}
break;
}
return (FALSE);
}
BOOL APIENTRY vncProperties::HostProc(
HWND hwnd,
UINT message,
UINT wParam,
LONG lParam)
{
vncProperties* _this=vncProperties::singleton;
switch (message)
{
case WM_INITDIALOG:
vncProperties::singleton->InitHostDialog(hwnd);
SendMessage(hwnd,WM_COMMAND,IDC_HOST_AUTOSTART,0);
return (TRUE);
case WM_TIMER:
TimerProc(hwnd, IDC_HOST_HELPTEXT);
break;
case WM_NOTIFY:
return NotifyProc(hwnd, ((NMHDR FAR *) lParam)->code, &(vncProperties::VerifyHost), &(vncProperties::ApplyHost));
case WM_COMMAND:
if(EnableApply(wParam,hwnd))
{
switch(LOWORD(wParam))
{
case IDC_SERVER_MODE:
{
if(IsDlgButtonChecked(hwnd,IDC_SERVER_MODE))
{
if(!_this->m_pref_Security_AllowIncoming)
{
CheckDlgButton(hwnd,IDC_SERVER_MODE, FALSE);
MessageBox(hwnd,sz_IDS_HOST_MODE_NOT_AVAILABLE,sz_IDS_HOST_MODE_NOT_AVAILABLE_CAPTION,MB_ICONINFORMATION);
}
else
{
_this->EnableServerMode(hwnd, true);
if(!IsDlgButtonChecked(hwnd, IDC_HOST_AUTOSTART) &&
!IsDlgButtonChecked(hwnd, IDC_HOST_AUTOSTART_SERVICE))
CheckDlgButton(hwnd, IDC_HOST_AUTOSTART, TRUE);
}
SendMessage(hwnd,WM_COMMAND,IDC_HOST_AUTOSTART,0);
}
else
_this->EnableServerMode(hwnd, false);
break;
}
case IDC_HOST_AUTOSTART:
case IDC_HOST_AUTOSTART_SERVICE:
{
bool isHost = IsDlgButtonChecked(hwnd,IDC_SERVER_MODE);
// EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),isHost);
//MAMS: Unter WinVista wird der Service Bereich ausgeblendet
if (vncService::VersionMajor() == 6)
{
ShowWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),SW_HIDE);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),FALSE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_REQADMIN),SW_HIDE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),SW_HIDE);
}
else
{
if (vncService::getAllowanceServiceStart())
//if (RunningAsAdministrator())
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),isHost);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_REQADMIN),SW_HIDE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),SW_SHOW);
}
else
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),FALSE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_REQADMIN),SW_SHOW);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),SW_HIDE);
}
}
if (!_this->m_server->IsInstallAutostartAllowed())
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),FALSE);
CheckDlgButton(hwnd, IDC_HOST_AUTOSTART, _this->m_server->AutostartSetting() == 1);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_RO_EXPLAIN),SW_SHOW);
}
else
{
ShowWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_RO_EXPLAIN),SW_HIDE);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),isHost);
}
if(IsDlgButtonChecked(hwnd,IDC_SERVER_MODE))
if(IsDlgButtonChecked(hwnd,IDC_HOST_AUTOSTART))
{
CheckDlgButton(hwnd,IDC_HOST_AUTOSTART_SERVICE, FALSE);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),FALSE);
}
else
if(IsDlgButtonChecked(hwnd,IDC_HOST_AUTOSTART_SERVICE))
{
CheckDlgButton(hwnd,IDC_HOST_AUTOSTART, FALSE);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),FALSE);
}
break;
}
}
}
break;
}
return (FALSE);
}
bool vncProperties::EnableApply(UINT wParam, HWND hwnd)
{
if(wParam!=0 && wParam!=1) // it is a notification
{
switch(HIWORD(wParam))
{
case EN_CHANGE:
case CBN_SELCHANGE:
case BN_CLICKED:
PropSheet_Changed(GetParent(hwnd),hwnd);
return true;
}
}
return false;
}
void vncProperties::EnableServerMode(HWND hwnd,bool enable)
{
if (!m_server->IsInstallAutostartAllowed())
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),FALSE);
}
else
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART),enable);
}
if (vncService::getAllowanceServiceStart())
// if (RunningAsAdministrator())
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),enable);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_REQADMIN),SW_HIDE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),SW_SHOW);
}
else
{
EnableWindow(GetDlgItem(hwnd,IDC_HOST_AUTOSTART_SERVICE),FALSE);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_REQADMIN),SW_SHOW);
ShowWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),SW_HIDE);
}
EnableWindow(GetDlgItem(hwnd,IDC_HOST_DISABLESHUTDOWN),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_SERVER_MODE_GROUP),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_SERVICE_EXPLANATION),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_PASSWORD),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_PASSWORD2),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_PASSWORD_LABEL),enable);
EnableWindow(GetDlgItem(hwnd,IDC_HOST_PASSWORD_LABEL2),enable);
}
void vncProperties::SaveHostMode(int autostart, const char* passwd)
{
m_pref_Host_Autostart = autostart;
memcpy(m_pref_Host_Passwd, passwd, MAXPWLEN);
Save();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -