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

📄 vncconfig.cxx.svn-base

📁 wince下的VNC 控制。X86下的源码。完全来源于共享源码。调试OK。
💻 SVN-BASE
字号:
/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
 * 
 * This 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 software 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 software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 * USA.
 */

#include <windows.h>
#include <commctrl.h>
#include <string.h>
#ifdef WIN32
#define strcasecmp _stricmp
#endif

#include "resource.h"
#include <rfb/Logger_stdio.h>
#include <rfb/LogWriter.h>
#include <rfb/SSecurityFactoryStandard.h>
#include <rfb_wince/Dialog.h>
#include <rfb_wince/RegConfig.h>
#include <rfb_wince/CurrentUser.h>

using namespace rfb;
using namespace rfb::win32;

static LogWriter vlog("main");


#include <vncconfig/Authentication.h>
#include <vncconfig/Connections.h>
#include <vncconfig/Sharing.h>
#include <vncconfig/Hooking.h>
#include <vncconfig/Inputs.h>
//#include <vncconfig/Legacy.h>
#include <vncconfig/Desktop.h>


TStr rfb::win32::AppName("VNC Config");


#ifdef _DEBUG
BoolParameter captureDialogs("CaptureDialogs", "", false);
#endif

HKEY configKey = HKEY_CURRENT_USER;


void
processParams(int argc, char* argv[]) {
  for (int i=1; i<argc; i++) {
    if (strcasecmp(argv[i], "-service") == 0) {
      configKey = HKEY_LOCAL_MACHINE;
    } else if (strcasecmp(argv[i], "-user") == 0) {
      configKey = HKEY_CURRENT_USER;
    } else {
      // Try to process <option>=<value>, or -<bool>
      if (Configuration::setParam(argv[i], true))
        continue;
      // Try to process -<option> <value>
      if ((argv[i][0] == '-') && (i+1 < argc)) {
        if (Configuration::setParam(&argv[i][1], argv[i+1], true)) {
          i++;
          continue;
        }
      }
    }
  }
}


int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPTSTR cmdLine, int cmdShow) {

// Thomas 21.05.2008 remove debug output		
  // Configure debugging output
//#ifdef _DEBUG
//  AllocConsole();
//  freopen("CONIN$","rb",stdin);
//  freopen("CONOUT$","wb",stdout);
//  freopen("CONOUT$","wb",stderr);
//  setbuf(stderr, 0);
//  initStdIOLoggers();
//  LogWriter vlog("main");
//  logParams.setParam("*:stderr:100");
//  vlog.info("Starting vncconfig applet");
//#endif

  try {
    try {
      // Process command-line args
      int argc = __argc;
      char** argv = __argv;
      processParams(argc, argv);
	   
	  // Override whatever security it already had (NT only)
      bool warnOnChangePassword = false;

      // Create the required configuration registry key
      RegKey rootKey;
      rootKey.createKey(configKey, _T("Software\\RealVNC\\WinVNC4"));
  
      // Start a RegConfig thread, to load in existing settings
      RegConfigThread config;
      config.start(configKey, _T("Software\\RealVNC\\WinVNC4"));

      // Build the dialog
      std::list<PropSheetPage*> pages;
      AuthenticationPage auth(rootKey); pages.push_back(&auth);
      auth.setWarnPasswdInsecure(warnOnChangePassword);
      ConnectionsPage conn(rootKey); pages.push_back(&conn);
      InputsPage inputs(rootKey); pages.push_back(&inputs);
      SharingPage sharing(rootKey); pages.push_back(&sharing);
      DesktopPage desktop(rootKey); pages.push_back(&desktop);
      HookingPage hooks(rootKey); pages.push_back(&hooks);
//      LegacyPage legacy(rootKey, configKey == HKEY_CURRENT_USER); pages.push_back(&legacy);

      // Load the default icon to use
      //HICON icon = (HICON)LoadImage(inst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_SHARED);
      HICON icon = (HICON)LoadImage(inst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);

      // Create the PropertySheet handler
      TCHAR* propSheetTitle = _T("VNC Server Properties (Service-Mode)");
      if (configKey == HKEY_CURRENT_USER)
        propSheetTitle = _T("VNC Server Properties (User-Mode)");
      PropSheet sheet(inst, propSheetTitle, pages, icon);

#ifdef _DEBUG
      vlog.debug("capture dialogs=%s", captureDialogs ? "true" : "false");
      sheet.showPropSheet(0, true, false, captureDialogs);
#else
      sheet.showPropSheet(0, true, false);
#endif
    } catch (rdr::SystemException& e) {
      switch (e.err) {
      case ERROR_ACCESS_DENIED:
        MsgBox(0, _T("You do not have sufficient access rights to run the VNC Configuration applet"),
               MB_ICONSTOP | MB_OK);
        return 1;
      };
      throw;
    }

  } catch (rdr::Exception& e) {
    MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK);
    return 1;
  }
  
  return 0;
}

⌨️ 快捷键说明

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