本文整理汇总了C++中OnStart函数的典型用法代码示例。如果您正苦于以下问题:C++ OnStart函数的具体用法?C++ OnStart怎么用?C++ OnStart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OnStart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Setup
int BaseApp::InternalSetup()
{
try
{
Setup();
}
catch(const std::exception & e)
{
Log::Error("Failed to setup application ({})", e.what());
system("pause");
return EXIT_FAILURE;
}
try
{
Time::Update();
InternalOnStart();
if(!_internal_started)
throw Exception("InternalOnStart() was not called on BaseApp!");
OnStart();
}
catch(const std::exception & e)
{
Log::Error("Exception: {}", e.what());
InternalOnForceQuit();
OnForceQuit();
system("pause");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
示例2: connect
tResult cJuryModule::Init()
{
// connect the widgets and methods
connect(m_pWidget->m_btnFileSelection, SIGNAL(released()), this, SLOT(OnManeuverListButton()));
connect(m_pWidget->m_btnFileSelectionDescr, SIGNAL(released()), this, SLOT(OnDescriptionFileButton()));
connect(m_pWidget->m_edtManeuverFile, SIGNAL(returnPressed()), this, SLOT(OnManeuverListSelected()));
connect(m_pWidget->m_edtManeuverFile, SIGNAL(editingFinished()), this, SLOT(OnManeuverListSelected()));
connect(m_pWidget->m_btnEmergencyStop, SIGNAL(released()), this, SLOT(OnEmergencyStop()));
connect(m_pWidget->m_btnStart, SIGNAL(released()), this, SLOT(OnStart()));
connect(m_pWidget->m_btnStop, SIGNAL(released()), this, SLOT(OnStop()));
connect(m_pWidget->m_btnRequest, SIGNAL(released()), this, SLOT(OnRequestReady()));
connect(m_pWidget->m_btnConnectDisconnect, SIGNAL(released()), this, SLOT(OnConnectDisconnect()));
connect(m_pWidget->m_btnManeuverlist, SIGNAL(released()), this, SLOT(SendManeuverList()));
connect(this, SIGNAL(SetDriverState(int, int)), this, SLOT(OnDriverState(int, int)));
connect(this, SIGNAL(SetLogText(QString)), this, SLOT(OnAppendText(QString)));
connect(this, SIGNAL(SetConnectionState()), this, SLOT(OnConnectionStateChange()));
connect(this, SIGNAL(SetControlState()), this, SLOT(OnControlState()));
connect(m_pWidget->m_comboSector, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboSectionBoxChanged(int)));
connect(m_pWidget->m_comboManeuver, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboActionBoxChanged(int)));
connect(m_pWidget->m_cbxLocalHost, SIGNAL(stateChanged(int)), this, SLOT(OnLocalhostCheckChanged(int)));
connect(m_pWidget->m_btnOpenTerminal, SIGNAL(released()), this, SLOT(OnOpenTerminalProcess()));
connect(&m_oTerminalProcess, SIGNAL(started()), this, SLOT(OnProcessStarted()));
connect(&m_oTerminalProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(OnProcessFinished(int,QProcess::ExitStatus)));
connect(&m_oTerminalProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(OnProcessError(QProcess::ProcessError)));
// set the connection and control state
SetConnectionState();
SetControlState();
RETURN_NOERROR;
}
示例3: Start
//
// FUNCTION: Start(DWORD, PWSTR *)
//
// PURPOSE: The function starts the service. It calls the OnStart virtual
// function in which you can specify the actions to take when the service
// starts. If an error occurs during the startup, the error will be logged
// in the Application event log, and the service will be stopped.
//
// PARAMETERS:
// * dwArgc - number of command line arguments
// * lpszArgv - array of command line arguments
//
void Start(DWORD dwArgc, PSTR *pszArgv)
{
DBGPrint("Called\n");
try
{
// Tell SCM that the service is starting.
BaseSetServiceStatus(SERVICE_START_PENDING,NO_ERROR,0);
// Perform service-specific initialization.
OnStart(dwArgc, pszArgv);
// Tell SCM that the service is started.
BaseSetServiceStatus(SERVICE_RUNNING,NO_ERROR,0);
}
catch (DWORD dwError)
{
// Log the error.
DBGPrint("Service Start");
// Set the service status to be stopped.
SetServiceStatus((SERVICE_STATUS_HANDLE)SERVICE_STOPPED, (LPSERVICE_STATUS) dwError);
}
catch (...)
{
// Log the error.
DBGPrint("Service failed to start.");
// Set the service status to be stopped.
BaseSetServiceStatus(SERVICE_STOPPED,NO_ERROR,0);
}
DBGPrint("Returning\n");
}
示例4: OnStart
void CWplayView::OnEasy()
{
// TODO: Add your command handler code here
OnStart();
startflag=1;
MessageBox("人人模式已开启");
}
示例5: WriteEventLogEntry
//
// FUNCTION: CServiceBase::Start(DWORD, PWSTR *)
//
// PURPOSE: The function starts the service. It calls the OnStart virtual
// function in which you can specify the actions to take when the service
// starts. If an error occurs during the startup, the error will be logged
// in the Application event log, and the service will be stopped.
//
// PARAMETERS:
// * dwArgc - number of command line arguments
// * lpszArgv - array of command line arguments
//
void CServiceBase::Start(DWORD dwArgc, PWSTR *pszArgv)
{
WriteEventLogEntry(L"Service starting.", TRACE_LEVEL_ERROR);
try
{
// Tell SCM that the service is starting.
SetServiceStatus(SERVICE_START_PENDING);
// Perform service-specific initialization.
OnStart(dwArgc, pszArgv);
// Tell SCM that the service is started.
SetServiceStatus(SERVICE_RUNNING);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry(L"Service failed to start.", dwError);
// Set the service status to be stopped.
SetServiceStatus(SERVICE_STOPPED, dwError);
}
catch (...)
{
// Log the error.
WriteEventLogEntry(L"Service failed to start.", TRACE_LEVEL_ERROR);
// Set the service status to be stopped.
SetServiceStatus(SERVICE_STOPPED);
}
}
示例6: switch
HRESULT Filter::Run(REFERENCE_TIME start)
{
Lock lock;
HRESULT hr = lock.Seize(this);
if (FAILED(hr))
return hr;
//odbgstream os;
//os << "mkvsplit::Filter::Run" << endl;
switch (m_state)
{
case State_Stopped:
OnStart();
break;
case State_Paused:
case State_Running:
default:
break;
}
m_start = start;
m_state = State_Running;
return S_OK;
}
示例7: initialized
////////////////////////////////////////////////////////////
/// Start playing the audio stream
////////////////////////////////////////////////////////////
void SoundStream::Play()
{
// Check if the sound parameters have been set
if (myFormat == 0)
{
std::cerr << "Failed to play audio stream : sound parameters have not been initialized (call Initialize first)" << std::endl;
return;
}
// If the sound is already playing (probably paused), just resume it
if (myIsStreaming)
{
Sound::Play();
return;
}
// Notify the derived class
if (OnStart())
{
// Start updating the stream in a separate thread to avoid blocking the application
mySamplesProcessed = 0;
myIsStreaming = true;
Launch();
}
}
示例8: main
int main()
{
OnStart( "" );
OnStop();
return 0;
}
示例9: Init
void UGame::Start()
{
Init();
SimulationDateTime = InitialSimulationDateTime;
OnStart();
BPF_OnStart();
}
示例10: OnStart
Controller::Controller(string ConfFile) {
auto start = chrono::steady_clock::now();
try {
OnStart(ConfFile);
DispatchWs();
} catch (int e) {
XaLibError Error;
string ErrorDesc=Error.GetError(e);
SendHtmlHeaders();
SendError(e,ErrorDesc);
//cout<<"<WsData><error><number>"+FromIntToString(e)+"</number><description>"+ErrorDesc+"</description></error></WsData>"<<endl;
} catch (...) {
SendHtmlHeaders();
cout<<"Generic not handled Error"<<endl;
}
auto diff = chrono::steady_clock::now() - start;
string duration=to_string(chrono::duration <double, std::milli> (diff).count());
LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Action Execution Time In Ms -> "+duration);
//////VERIFICARE QUESTO CLOSE
LOG.Close();
};
示例11: OnGetData
////////////////////////////////////////////////////////////
/// /see SoundStream::OnGetData
////////////////////////////////////////////////////////////
bool Music::OnGetData(SoundStream::Chunk& Data)
{
// Fill the chunk parameters
Data.Samples = &mySamples[0];
Data.NbSamples = myFile->Read(&mySamples[0], mySamples.size());
// Check if we have reached the end of the audio file
if (Data.NbSamples < mySamples.size())
{
// Check if we must loop
if (myLoop)
{
if (OnStart())
{
// We succeeded to restart the audio playback
Data.NbSamples += myFile->Read(&mySamples[Data.NbSamples], mySamples.size() - Data.NbSamples);
return true;
}
}
// No more audio samples to read : we stop the playback
return false;
}
// End of audio file has not been reached, continue playback
return true;
}
示例12: OnStart
void StateMachine::Update( float dt )
{
//状态机自生的更新状态回调
if (m_bIsFirstUpdate)
{
OnStart();
OnUpdate(dt);
m_bIsFirstUpdate = false;
if (m_pCurState != nullptr)
m_pCurState->OnEnter();
}
else
{
OnUpdate(dt);
}
//检查状态的改变,并回调相应的函数
if (m_pCurState != nullptr)
{
int nStateIdOfChange = m_pCurState->OnCheckTranslation(m_oParameter);
//状态需要改变
if (nStateIdOfChange != m_pCurState->GetStateId())
{
MapStateList::const_iterator iterFinder = m_mapStateList.find(nStateIdOfChange);
if ( iterFinder != m_mapStateList.end() )
{
m_pCurState->OnExit();
m_pCurState = iterFinder->second;
m_pCurState->OnEnter();
}
}
m_pCurState->OnUpdate(dt);
}
}
示例13: switch
HRESULT Filter::Run(REFERENCE_TIME start)
{
Lock lock;
HRESULT hr = lock.Seize(this);
if (FAILED(hr))
return hr;
#ifdef _DEBUG
odbgstream os;
os << "webmvorbisencoder::Filter::Run" << endl;
#endif
switch (m_state)
{
case State_Stopped:
OnStart();
break;
case State_Paused:
case State_Running:
default:
break;
}
m_start = start;
m_state = State_Running;
return S_OK;
}
示例14: switch
void ribi::pylos::QtPylosMenuDialog::mousePressEvent(QMouseEvent *)
{
if (ui->label_theme->underMouse())
{
m_theme_bw = !m_theme_bw;
if (m_theme_bw)
ui->label_theme->setText("Theme: black & white");
else
ui->label_theme->setText("Theme: red & blue");
return;
}
if (ui->label_type->underMouse())
{
m_type_basic = !m_type_basic;
if (m_type_basic)
ui->label_type->setText("Game type: basic");
else
ui->label_type->setText("Game type: advanced");
return;
}
switch (m_selected)
{
case 0: OnStart(); return;
case 1: OnInstructions(); return;
case 2: OnAbout(); return;
case 3: this->close(); return;
}
}
示例15: StartEvent
//启动函数
bool CBaseMainManageForZ::Start()
{
if ((this==NULL)||(m_bRun==true)||(m_bInit==false)) return false;
//建立事件
CEvent StartEvent(FALSE,TRUE,NULL,NULL);
if (StartEvent==NULL) throw new CAFCException(TEXT("CBaseMainManageForZ::Start 事件建立失败"),0x41C);
//建立完成端口
m_hCompletePort=::CreateIoCompletionPort(INVALID_HANDLE_VALUE,NULL,NULL,0);
if (m_hCompletePort==NULL) throw new CAFCException(TEXT("CBaseMainManageForZ::Start m_hCompletePort 建立失败"),0x41D);
m_DataLine.SetCompletionHandle(m_hCompletePort);
//启动处理线程
UINT uThreadID=0;
HandleThreadStartStruct ThreadStartData;
ThreadStartData.pMainManage=this;
ThreadStartData.hCompletionPort=m_hCompletePort;
ThreadStartData.hEvent=StartEvent;
m_hHandleThread=(HANDLE)_beginthreadex(NULL,0,LineDataHandleThread,&ThreadStartData,0,&uThreadID);
if (m_hHandleThread==NULL) throw new CAFCException(TEXT("CBaseMainManageForZ::Start LineDataHandleThread 线程启动失败"),0x41E);
WaitForSingleObject(StartEvent,INFINITE);
//启动组件
AFCKernelStart();
if (m_KernelData.bStartSQLDataBase) m_SQLDataManage.Start();
if (m_KernelData.bStartTCPSocket) m_TCPSocket.Start(m_KernelData.uAcceptThreadCount,m_KernelData.uSocketThreadCount);
//调用接口
if (OnStart()==false) throw new CAFCException(TEXT("CBaseMainManageForZ::Start OnStart 函数错误"),0x41F);
//设置数据
m_bRun=true;
return true;
}