|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Running a process in a thread?Is there a possibility to run an external process (exe) in on of my C#
Apps Thread? I would need that because I don't want them to run anymore when my programm crashes. Also I don't want to have the processes visible in the task manager. Hi,
if you create a new process it will be, well , a new process :) what you can do is terminate the process ( Process.Kill ) when your program ends, for this you need to hook AppDomain.DomainUnload -- Show quoteHide quoteIgnacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Tyron" <tyron.madle***@kath-kirche-vorarlberg.at> wrote in message news:1146054378.691597.209460@t31g2000cwb.googlegroups.com... > Is there a possibility to run an external process (exe) in on of my C# > Apps Thread? > I would need that because I don't want them to run anymore when my > programm crashes. Also I don't want to have the processes visible in > the task manager. > Tyron wrote:
> Is there a possibility to run an external process (exe) in on of my C# Yes, but it won't help you.> Apps Thread? > I would need that because I don't want them to run anymore when my You'd have to manually kill the process when you detect a crash.> programm crashes. > Also I don't want to have the processes visible in the task manager. If it's a separate process, it would be visible in task manager.Now, if it's another .NET app you could load it in a different AppDomain and call the Main method appropriately. Heck, you could probably do that with non-.NET executables with a lot of work. I wouldn't expect it to be particularly reliable though. Jon "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message No, you can't run a process in a thread, what makes you believe you can do news:1146055658.322123.296830@i39g2000cwa.googlegroups.com... | Tyron wrote: | > Is there a possibility to run an external process (exe) in on of my C# | > Apps Thread? | | Yes, but it won't help you. | this? Willy. Willy Denoyette [MVP] <willy.denoye***@telenet.be> wrote:
> | > Is there a possibility to run an external process (exe) in on of my C# I initially misinterpreted the question. It's certainly possible to > | > Apps Thread? > | > | Yes, but it won't help you. > No, you can't run a process in a thread, what makes you believe you can do > this? create a new thread, and launch the process from that - but it will indeed run on its own threads and be a completely distinct process. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too Running a process from a thread is not going to change anything. the process
is started by your app, and the process must either stop by itself or be stopped by an external force. A separte thread is only a child thread of your main thread. What you need to do is ensure that if your app "crashes" it stops the process before exiting. -- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP Professional Numbskull Hard work is a medication for which there is no placebo. "Tyron" <tyron.madle***@kath-kirche-vorarlberg.at> wrote in message news:1146054378.691597.209460@t31g2000cwb.googlegroups.com... > Is there a possibility to run an external process (exe) in on of my C# > Apps Thread? > I would need that because I don't want them to run anymore when my > programm crashes. Also I don't want to have the processes visible in > the task manager. > Tyron,
I think you are not clear how processes and threads are related to each other. The process has threads. You cannot run a process IN a thread. You can create a thread that starts a process, but this process will be different entity and will have its own threads. If the program you want to run is a managed .NET program you can run it in a new application domain in the same Windows process. -- Show quoteHide quoteStoitcho Goutsev (100) "Tyron" <tyron.madle***@kath-kirche-vorarlberg.at> wrote in message news:1146054378.691597.209460@t31g2000cwb.googlegroups.com... > Is there a possibility to run an external process (exe) in on of my C# > Apps Thread? > I would need that because I don't want them to run anymore when my > programm crashes. Also I don't want to have the processes visible in > the task manager. > Thanks a lot for all your answers.
The process I want to run is not a .net assembly but rather a linux tool ported to windows called wget (I guess most of you know it). I guess, since wget is open source, I maybe could recode some parts of it so that I can compile it as a dll and do some PInvoke. On this way it should be possible to run a "wget-process" in a thread. Cheers Tyron wrote:
> The process I want to run is not a .net assembly but rather a linux What functionality of wget do you particularly need? A lot of it is> tool ported to windows called wget (I guess most of you know it). > I guess, since wget is open source, I maybe could recode some parts of > it so that I can compile it as a dll and do some PInvoke. On this way > it should be possible to run a "wget-process" in a thread. already in the framework in the form of WebClient, HttpWebRequest etc. Jon I need all of them ;)
I've written a GUI for it (MyWebGet, http://www.tyron.at/tm/dev.php in case you're interested) and I am curious if I can embedd wget even better into the GUI Hi,
Of course we know wget :) You need not to modify it, you can run it as a non-visible program (it will shows n the windows task manager though) it will not appear in the task toolbar nor using ALT+TAB . You could even get the outout of the console and show it in your win app. -- Show quoteHide quoteIgnacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Tyron" <tyron.madle***@kath-kirche-vorarlberg.at> wrote in message news:1146063270.196079.324530@e56g2000cwe.googlegroups.com... > Thanks a lot for all your answers. > > The process I want to run is not a .net assembly but rather a linux > tool ported to windows called wget (I guess most of you know it). > I guess, since wget is open source, I maybe could recode some parts of > it so that I can compile it as a dll and do some PInvoke. On this way > it should be possible to run a "wget-process" in a thread. > > Cheers >
Set primarykey to a datatable
Copy file from http location redefinition of generic methods Change RowState property of DataRow C# Extended Text Editor TreeView populate on demand and mutations after expanding Serialization null value How to access main form functions from child forms Typed data access? |
|||||||||||||||||||||||