wxProcess
BlitzMax Forums/Brucey's Modules/wxProcess
| ||
Is this complete? revision 249. |
| ||
Not quite... everything except the event and wxExecute() - and untested barring wxShell() :-p In the meantime, to keep you amused, try the ledpanel sample. |
| ||
Have already tried wxLEDPanel sample, very cool. Need to work out which product I can use it in :-) |
| ||
Okay... have finished off the missing bits - OnTerminate(), wxExecute(), and the wxProcessEvent. It compiles, but is untested, so your mileage may vary at the moment... |
| ||
Need to work out which product I can use it in :-) I thought exactly the same! |
| ||
OK, wxExecute() now working, is anyone planning example code? I have had a quick look and it seems a little more complicated than I thought. I have an application that I need to execute and then parse the output which it returns. |
| ||
There is a process sample that probably needs to be done :-) It's also possible that I need to add some more stream types to make your life easier. |
| ||
first attempt at sync processing and it fails to return any data? :-(Type MyFrame Extends wxFrame Field m_versionProcess:wxProcess ' Field m_versionProcess:MyProcess Field m_pid:Int Field m_errors:String[] Field m_readBuffer:String[1024] ' Method OnInit() ' m_versionProcess = New wxProcess.Create(Self,0) ' m_versionProcess.Redirect() m_versionProcess = New wxProcess.CreateWithFlags(wxPROCESS_REDIRECT) Local command:String = AppDir + res + "/resources/librarian.exe -v" m_pid = wxExecute(command, wxEXEC_SYNC, m_versionProcess ) Local p_in:wxInputStream = m_versionProcess.GetErrorStream() ' While m_versionProcess.Exists(m_pid) ' DebugLog "process running" ' Wend p_in.Read(m_readBuffer, 1024) For Local i:Int=0 To 20 DebugLog Asc( m_readBuffer[i] ) Next m_versionProcess.free End Method End TypeThe executable just returns some version info with the switch -v |
| ||
Here's one working with the latest code :SuperStrict Framework wx.wxApp Import wx.wxProcess New MyApp.run() Type MyApp Extends wxApp Method OnInit:Int() Local m_versionProcess:wxProcess = New wxProcess.CreateWithFlags(wxPROCESS_REDIRECT) Local command:String = "lst" Local m_pid:Int = wxExecute(command, wxEXEC_SYNC, m_versionProcess ) Local p_in:wxInputStream = m_versionProcess.GetInputStream() If p_in Then Local textInput:wxTextInputStream = New wxTextInputStream.Create(p_in) While Not p_in.Eof() DebugLog textInput.ReadLine() Wend End If m_versionProcess.free Return False End Method End Type :o) |