本文整理汇总了C++中Configurator::setServiceFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ Configurator::setServiceFlag方法的具体用法?C++ Configurator::setServiceFlag怎么用?C++ Configurator::setServiceFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configurator
的用法示例。
在下文中一共展示了Configurator::setServiceFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l
TvnServer::TvnServer(bool runsInServiceContext, StringStorage vncIniDirPath /*""*/, bool runAsPortable /*=false*/ )
: Singleton<TvnServer>(),
ListenerContainer<TvnServerListener *>(),
m_runAsService(runsInServiceContext),
m_runPortable(runAsPortable),
m_rfbClientManager(0),
m_httpServer(0), m_controlServer(0), m_rfbServer(0)
{
Configurator *configurator = Configurator::getInstance();
configurator->setServiceFlag(m_runAsService);
configurator->setPortableRunFlag(m_runPortable);
configurator->setVncIniDirectoryPath ( vncIniDirPath.getString() );
configurator->load();
m_config = Configurator::getInstance()->getServerConfig();
resetLogFilePath();
m_log.changeLevel(m_config->getLogLevel());
Log::message(_T("TightVNC Server Build on %s"), BuildTime::DATE);
Log::info(_T("Initialize WinSock"));
try {
WindowsSocket::startup(2, 1);
} catch (Exception &ex) {
Log::interror(_T("%s"), ex.getMessage());
}
ZombieKiller *zombieKiller = new ZombieKiller();
m_rfbClientManager = new RfbClientManager(NULL);
m_rfbClientManager->addListener(this);
Configurator::getInstance()->addListener(this);
{
AutoLock l(&m_mutex);
restartMainRfbServer();
(void)m_extraRfbServers.reload(m_runAsService, m_rfbClientManager);
restartHttpServer();
restartControlServer();
}
}
示例2: runConfigurator
int ControlApplication::runConfigurator(bool configService, bool isRunAsRequested)
{
// If not enough rights to configurate service, then restart application requesting
// admin access rights.
if (configService && (IsUserAnAdmin() == FALSE)) {
// If admin rights already requested and application still don't have them,
// then show error message and exit.
if (isRunAsRequested) {
MessageBox(0,
StringTable::getString(IDS_ADMIN_RIGHTS_NEEDED),
StringTable::getString(IDS_MBC_TVNCONTROL),
MB_OK | MB_ICONERROR);
return 0;
}
// Path to tvnserver binary.
StringStorage pathToBinary;
// Command line for child process.
StringStorage childCommandLine;
// Get path to tvnserver binary.
Environment::getCurrentModulePath(&pathToBinary);
// Set -dontelevate flag to tvncontrol know that admin rights already requested.
childCommandLine.format(_T("%s -dontelevate"), m_commandLine.getString());
// Start child.
try {
Shell::runAsAdmin(pathToBinary.getString(), childCommandLine.getString());
} catch (SystemException &sysEx) {
if (sysEx.getErrorCode() != ERROR_CANCELLED) {
MessageBox(0,
sysEx.getMessage(),
StringTable::getString(IDS_MBC_TVNCONTROL),
MB_OK | MB_ICONERROR);
}
return 1;
} // try / catch.
return 0;
}
Configurator *configurator = Configurator::getInstance();
configurator->setServiceFlag(configService);
configurator->load();
ConfigDialog confDialog(configService, 0);
return confDialog.showModal();
}