本文整理汇总了C++中wxExecute函数的典型用法代码示例。如果您正苦于以下问题:C++ wxExecute函数的具体用法?C++ wxExecute怎么用?C++ wxExecute使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxExecute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxProcess
void FileExplorerUpdater::ExecMain()
{
m_exec_output.Empty();
m_exec_proc=new wxProcess(this);
m_exec_proc->Redirect();
m_exec_mutex->Lock();
m_exec_proc_id=wxExecute(m_exec_cmd,wxEXEC_ASYNC,m_exec_proc);
if(m_exec_proc_id==0)
{
m_exec_cond->Signal();
m_exec_mutex->Unlock();
return;
}
m_exec_timer=new wxTimer(this,ID_EXEC_TIMER);
m_exec_timer->Start(100,true);
}
示例2: wxASSERT_MSG
/* static */
wxProcess *wxProcess::Open(const wxString& cmd, int flags)
{
wxASSERT_MSG( !(flags & wxEXEC_SYNC), wxT("wxEXEC_SYNC should not be used." ));
wxProcess *process = new wxProcess(wxPROCESS_REDIRECT);
long pid = wxExecute(cmd, flags, process);
if( !pid )
{
// couldn't launch the process
delete process;
return NULL;
}
process->SetPid(pid);
return process;
}
示例3: Redirect
void CPyProcess::Execute(const wxChar* cmd)
{
if(redirect) {
Redirect();
}
// make process group leader so Cancel kan terminate process including children
m_pid = wxExecute(cmd, wxEXEC_ASYNC|wxEXEC_MAKE_GROUP_LEADER, this);
if (!m_pid) {
wxLogMessage(_T("could not execute '%s'"),cmd);
} else {
wxLogMessage(_T("starting '%s' (%d)"),cmd,m_pid);
}
if (redirect) {
m_timer.Start(100); //msec
}
}
示例4: switch
void MyApp::OnFileMenu(wxCommandEvent &ev)
{
switch (ev.GetId())
{
case wxMaximaFrame::menu_new_id:
case ToolBar::tb_new:
case wxMaxima::mac_newId:
// Mac computers insist that all instances of a new application need to share
// the same process. On all other OSes we create a separate process for each
// window: This way if one instance of wxMaxima crashes all the other instances
// are still alive.
#if defined __WXMAC__
NewWindow();
#else
// NewWindow();
wxExecute(wxT("\"")+wxStandardPaths::Get().GetExecutablePath()+wxT("\""));
#endif
break;
case wxMaxima::mac_openId:
{
wxString file = wxFileSelector(_("Open"), wxEmptyString,
wxEmptyString, wxEmptyString,
_("wxMaxima document (*.wxm, *.wxmx)|*.wxm;*.wxmx"),
wxFD_OPEN);
if (file.Length() > 0)
NewWindow(file);
}
break;
case wxID_EXIT:
{
bool quit = true;
std::list<wxMaxima *>::iterator it=m_topLevelWindows.begin();
while(it != m_topLevelWindows.end())
{
if (!(*it)->Close())
{
quit = false;
break;
}
}
if (quit)
wxExit();
}
break;
}
}
示例5: FindWindow
void NetstatPanel::OnStartTest(wxCommandEvent& event)
{
if( !m_running )
{
((wxButton*)this->
FindWindow( wxID_NETSTAT_BUTTON_START ))->
SetLabel( wxT("Avbryt") );
this->m_TextOut->Clear();
this->SetCursor( *wxHOURGLASS_CURSOR );
wxString cmd;
#ifdef WIN32
cmd =
wxT("netstat -na ");
#endif
#ifdef MACOSX
cmd =
wxT("netstat -nafinet");
#endif
m_running = true;
m_proc->Redirect();
if( wxExecute( cmd, wxEXEC_ASYNC, m_proc ) <= 0 )
{
this->m_TextOut->AppendText( wxT("Kommandot misslyckades\n") );
m_die = true;
}
m_procIn = m_proc->GetInputStream();
if( !m_proc->IsInputOpened() ) {
wxMessageBox( wxT("Kunde inte starta netstat.") );
return;
}
m_timer->Start(1000);
} // if running
else
{
m_die = true;
}
}
示例6: GetWxFBPath
void wxFormBuilder::DoLaunchWxFB(const wxString& file)
{
wxString fbpath = GetWxFBPath();
if (fbpath.IsEmpty()) {
wxMessageBox(_("Failed to launch wxFormBuilder, no path specified\nPlease set wxFormBuilder path from Plugins -> wxFormBuilder -> Settings..."),
wxT("EmbeddedLite"), wxOK|wxCENTER|wxICON_WARNING);
return;
}
ConfFormBuilder confData;
m_mgr->GetConfigTool()->ReadObject(wxT("wxFormBuilder"), &confData);
wxString cmd = confData.GetCommand();
cmd.Replace(wxT("$(wxfb)"), fbpath);
cmd.Replace(wxT("$(wxfb_project)"), wxString::Format(wxT("\"%s\""), file.c_str()));
// Launch !
wxExecute(cmd);
}
示例7: wxT
void ExternalToolsPlugin::DoLaunchTool(const ToolInfo& ti)
{
wxString command, working_dir;
command << wxT("\"") << ti.GetPath() << wxT("\" ") << ti.GetArguments();
working_dir = ti.GetWd();
if (m_mgr->IsWorkspaceOpen()) {
command = m_mgr->GetMacrosManager()->Expand(command, m_mgr, m_mgr->GetSolution()->GetActiveProjectName());
working_dir = m_mgr->GetMacrosManager()->Expand(working_dir, m_mgr, m_mgr->GetSolution()->GetActiveProjectName());
}
// check to see if we require to save all files before continuing
if (ti.GetSaveAllFiles() && !m_mgr->SaveAll())
return;
if (ti.GetCaptureOutput() == false) {
// change the directory to the requested working directory
DirSaver ds;
wxSetWorkingDirectory(working_dir);
// apply environment
EnvSetter envGuard(m_mgr->GetEnv());
wxExecute(command);
} else {
// create a piped process
if (m_pipedProcess && m_pipedProcess->IsBusy()) {
// a process is already running
return;
}
m_pipedProcess = new AsyncExeCmd(m_mgr->GetOutputWindow());
DirSaver ds;
EnvSetter envGuard(m_mgr->GetEnv());
wxSetWorkingDirectory(working_dir);
// hide console if any,
// redirect output
m_pipedProcess->Execute(command, true, true);
if (m_pipedProcess->GetProcess()) {
m_pipedProcess->GetProcess()->Connect(wxEVT_END_PROCESS, wxProcessEventHandler(ExternalToolsPlugin::OnProcessEnd), NULL, this);
}
}
}
示例8: ReadExecOpts
//Format and (optionally) execute command
bool ExecInput::FormatCommand(const GameType *gtype, const wxString &host, int port,
const wxString &password, const wxString &name,
wxString *out, bool execute)
{
wxString path, order, conn, pass, nm;
wxString command;
ReadExecOpts(gtype, &path, &order, &conn, &pass, &nm);
if (path.IsEmpty() || order.IsEmpty() || conn.IsEmpty())
return false;
VarMap vmap, optmap;
vmap["host"] = host;
vmap["port"] = wxString::Format("%d", port);
optmap["connect_opt"] = VarSubst(conn, vmap);
if (!password.IsEmpty() && !pass.IsEmpty())
{
vmap["password"] = password;
optmap["password_opt"] = VarSubst(pass, vmap);
}
if (!name.IsEmpty() && !nm.IsEmpty())
{
vmap["name"] = name;
optmap["name_opt"] = VarSubst(nm, vmap);
}
wxFileName exec(path);
exec.Normalize();
wxSetWorkingDirectory(exec.GetPath());
command = exec.GetFullPath() + _T(" ") + VarSubst(order, optmap);
if (out)
*out = command;
if (execute)
wxExecute(command);
return true;
}
示例9: wxT
void DialogAbout::OnLeftDown( wxMouseEvent &event )
{
if( event.m_x > 320 &&
event.m_x < 400 &&
event.m_y > 330 &&
event.m_y < 354 )
{
wxString strHelpURL = wxT("http://www.ghn.se");
wxMimeTypesManager manager;
wxFileType * filetype = manager.GetFileTypeFromExtension( wxT("html") );
wxString command = filetype->GetOpenCommand( strHelpURL );
wxExecute(command);
}
event.Skip();
}
示例10: wxExecute
void ProcUtils::ExecuteCommand(const wxString &command, wxArrayString &output, long flags)
{
#ifdef __WXMSW__
wxExecute(command, output, flags);
#else
FILE *fp;
char line[512];
memset(line, 0, sizeof(line));
fp = popen(command.mb_str(wxConvUTF8), "r");
while ( fgets( line, sizeof line, fp)) {
output.Add(wxString(line, wxConvUTF8));
memset(line, 0, sizeof(line));
}
pclose(fp);
#endif
}
示例11: sCommand
INT32 PluginOILFilter::HowCompatible(PathName& FileName)
{
INT32 HowCompatible = 0;
// Here we need to run the plugin synchronously with the following options
// -c -f <filename>
// Check stderr for errors
// Get HowCompatible from stdout
if (!m_CanImport.IsEmpty())
{
wxString sCommand(m_CanImport);
sCommand.Replace(_T("%IN%"), (LPCTSTR)FileName.GetPath());
TRACEUSER("Gerry", _T("Running '%s'"), sCommand.c_str());
wxArrayString saOutput;
wxArrayString saErrors;
INT32 code = wxExecute(sCommand, saOutput, saErrors, wxEXEC_NODISABLE);
TRACEUSER("Gerry", _T("wxExecute returned %d"), code);
if (code == 0)
{
// Extract the value from saOutput
if (saOutput.Count() > 0)
{
INT32 Val = wxAtoi(saOutput[0]);
TRACEUSER("Gerry", _T("Command '%s' returned string '%s'"), sCommand.c_str(), saOutput[0].c_str());
TRACEUSER("Gerry", _T("Value = %d"), Val);
if (Val >= 0 && Val <= 10)
{
HowCompatible = Val;
}
}
else
{
TRACEUSER("Gerry", _T("Command '%s' returned no output value"), sCommand.c_str());
}
}
else
{
TRACEUSER("Gerry", _T("Command '%s' exited with code %d"), sCommand.c_str(), code);
}
}
return(HowCompatible);
}
示例12: wxExecute
long wxExecute(const wxString& command, int flags, wxProcess *process,
const wxExecuteEnv *env)
{
// FIXME: shouldn't depend on wxCmdLineParser
wxArrayString args(wxCmdLineParser::ConvertStringToArgs(command));
size_t n = args.size();
wxChar **argv = new wxChar*[n + 1];
argv[n] = NULL;
while (n-- > 0)
argv[n] = const_cast<wxChar*>((const char *)args[n].c_str());
long result = wxExecute(argv, flags, process);
delete [] argv;
return result;
}
示例13: OpenWebBrowser
void OpenWebBrowser(const wxString& url)
{
if (sett().GetWebBrowserUseDefault()
// These shouldn't happen, but if they do we use the default browser anyway.
||
sett().GetWebBrowserPath() == wxEmptyString || sett().GetWebBrowserPath() == _T("use default")) {
if (!wxLaunchDefaultBrowser(url)) {
wxLogWarning(_T("can't launch default browser"));
customMessageBoxNoModal(SL_MAIN_ICON, _("Couldn't launch browser. URL is: ") + url, _("Couldn't launch browser."));
}
} else {
if (!wxExecute(sett().GetWebBrowserPath() + _T(" ") + url, wxEXEC_ASYNC)) {
wxLogWarning(_T("can't launch browser: %s"), sett().GetWebBrowserPath().c_str());
customMessageBoxNoModal(SL_MAIN_ICON, _("Couldn't launch browser. URL is: ") + url + _("\nBroser path is: ") + sett().GetWebBrowserPath(), _("Couldn't launch browser."));
}
}
}
示例14: wxExecute
void Utils::OpenFolder(wxFileName path)
{
wxString cmd;
#if WINDOWS
cmd = "explorer ";
#elif OSX
cmd = "open ";
#elif LINUX
cmd = "xdg-open ";
#endif
cmd.Append("\"");
cmd.Append(path.GetFullPath());
cmd.Append("\"");
wxExecute(cmd);
}
示例15: wxURL
void MAJ::OndownloadAndInstallBtClick(wxCommandEvent& event)
{
//Warn the user his work can be lost
if ( wxMessageBox(_("GDevelop will be closed at the end of the download so as to install the new version. Don't forget to save your work.\nDownload and install the new version \?"), _("Installation of the new version"), wxYES_NO | wxICON_QUESTION, this) == wxNO )
return;
wxString tempDir = wxFileName::GetHomeDir()+"/.GDevelop";
//Open connection to file
wxHTTP http;
wxURL *url = new wxURL(_T("http://www.compilgames.net/dl/gd.exe"));
wxInputStream * input = url->GetInputStream();
if (input!=NULL) {
unsigned int current_progress = 0;
char buffer[1024];
wxProgressDialog progress(_("Download"),_("Progress"),(int)input->GetSize(), NULL, wxPD_CAN_ABORT | wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_REMAINING_TIME);
wxFileOutputStream outputfile(tempDir+"/newgd.exe");
while(!input->Eof() && current_progress!=input->GetSize()) { //Download part as long we haven't reached the end
input->Read((void *)buffer,1024);
outputfile.Write((const void *)buffer,input->LastRead());
current_progress+=input->LastRead();
if ( !progress.Update(current_progress) ) //Enable the user to stop downloading
{
if ( wxMessageBox(_("Stop the download \?\n\nYou can also get the new version by downloading it on our website."), _("Stop the download"), wxYES_NO | wxICON_QUESTION, this) == wxYES )
{
wxRemoveFile(tempDir+"/newgd.exe");
return;
}
else
progress.Resume();
}
}
delete input;
}
else
{
gd::LogWarning( _( "Unable to connect to the server so as to check for updates.\nCheck :\n-Your internet connection\n-Your firewall-If you can manually access our site.\n\nYou can disable Check for updates in the preferences of GDevelop." ) );
return;
}
wxExecute(tempDir+"/newgd.exe /SILENT /LANG="+gd::LocaleManager::Get()->locale->GetLocale(), wxEXEC_ASYNC);
EndModal(2);
}