I am afraid that is how .NET (and Java and to an extent C++) is designed to work. They throw execeptions instead of returning error codes. The intention is to better separate error handling code from normal path of execution code.
I agree...
Andrew, can you still answer to the 2 questions above...?
sorry for the stupid questions.I had paused my main B4P project for one year and a half, meanwhile working and playing with a variety of programming languages, so it is really hard to get into my own code line after that period of time.After some reading and reviewing it is getting better and i recall a lot of things i already knew but apparently shifted into other regions of my brain..*lol*
Sorry again for asking fundamental questions..certainly i will ask you questions again ( at least for the threading) but before i will continue to read and try to get familiar with my code....;-)
I've just started using the threading library merely because I thought it might provide a better alternative to Shell() (as mentioned in the forum).
I want to analyse the output of a DOS command (I do not have a need to run on any PPC for this purpose) and hoped to use stdout redirection. But I could not make this work by adding the redirection to the "argument" parameter of Process.Start(); maybe because redirection is a feature of Cmd.exe which is not involved in this process.
Unfortunately actually using Cmd.exe in the Process.Start(), while it works as intended, briefly pops up the cmd window. Since I am doing this every few seconds in the background the disruption to other windows due to cmd.exe appearing for a fraction of a second in the foreground is intolerable.
Anyone know of a way round this? Cmd.exe doesn't have a "start minimised" option!
Alternatively, what I'm trying to do is monitor network access to find what process suddenly downloads 50-80Mb soon after I start my PC but stops if I break the connection briefly. So I am using netstat to monitor traffic and capturing its output. netstat doesn't have an "output to file" option which would obviate the redirection problem. But I cannot find a Basic4PPC library that offers netstat data monitoring functionality. (I thought that network.dll might, but it is focused on client/server operation.)
Thanks Andrew, I hadn't heard of it. (And I asked some ex-work colleagues about the spurious traffic too.) It has help on "Network Troubleshooting" which I hope will lead me in the right direction, though it also says "Wireshark is not aimed (and may not be well suited either) for all the tasks mentioned".
Separately, I take it that there is no simple answer to running commands and capturing their stdout results...
I take it that there is no simple answer to running commands and capturing their stdout results...
The method that Process uses to start applications allows the default program to be invoked on say an html or jpg file. This method does not allow redirection.
There is an alternative way of starting an application that does allow redirection but this will only work directly on exe files. Process could be extended to do this but I have no plans to implement it as I don't think the work involved would be worth the return as I don't imagine this is anything but a niche requirement. I certainly haven't needed it. The only time I have needed to do do this in my Logcat viewer for Android that I have just written but that is a .NET C# application.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.