Single Status Update
Or for those of you who don't understand the title, "Real Blog". I need a place to get thoughts out that isn't my livejournal, and I figured someone may have an idea on this.
Programming in Windows can be a bitch sometimes when you don't know what to do. Or rather, it can be one when you don't know how to do something. Using C# and the .NET framework, it's really easy to launch a process (iow, "another program") from within one already running (see example below).
The hard part is what I am wanting to do. I want to actually kill the process, which I can do with a "proc.Kill();" command, but do so only when the process is finished doing what I told it to do.
If, for example, I had delibrately started a copy of my antivirus client, and pass in some command line option to automatically do a full system scan, I could assume that the scan would be finished when the CPU useage of the program goes back to 0 (or "idle"). But I'm worried that there'll be exceptions to this assumption and that there will be some program that will naturally idle during the course of its normal run through. Who knows, maybe the process I started connects to some server, which is busy, so it puts the process on hold. The process wouldn't have finished what it was supppsed to do, but would be idle.
Trying to decide how I'll tackle this is driving me insane. I suppose I could just implement a simple time limit. Like, "Launch this process, wait one hour, then kill it regardless," but that could cause problems as well. And the likelyhood that the process I launch will emit some sort of system-wide event that I can check for...well, who knows if it will (and I don't know quite how I'd catch the event anyways).
So yeah, programming for Windows isn't always hard, but figuring out how to pull some things off is. But the way I see programming, if I can think it up, it can be programmed somehow (maybe just not at the current moment).
Example of launching a process, embedded into something that should actually work: