Question Open and then close application

andrewsp1985

New member
Joined
Nov 24, 2008
Messages
1
Programming Experience
Beginner
Hi,
I agreed to help a friend out with a little project, don't have much information apart from this, he wants to open an application/file then close it after a certain amount of time. Is there anyway of doing this? I have been thinking about having a form with a browse button where you would specify the file or application, a text box or a list box where you would list how long you wanted to keep the application up for. When you hit a button the application/file is opened and the amount of time goes by then the application/file is closed again. He also wanted an option to do this repeatable so, maybe have another list box or text box to specify how many times it would open and then close the application. Any ideas how i would go about this. My programing knowledge is extremely limited, i'm a computer and network engineer not a programer. Any information would be great.
 
Its quite simple and i THINK i have what you need.
I don't think you can open it on its own after some time due to its not really running
but that would be different if its not actually the form your opening (form as in the program
GUI (front)) if its a textbox you want to hide you could put a timer onto the form and set it to the duration you want it to close at (its in miliseconds the timer duration) and then if its a textbox you want to hide put
Textbox1.hide
But if its the actual form you want to close then put
If you have multiple forms you might want to put the form your closing then you want to put something like
form1.close

If you want a closing screen to fade out just PM me and ill show you the code.
-Danny
 
Have a look at the Process class, in basic there is Start method you can use to start the app and a CloseMainWindow method that sends a close message to the app to ask it nicely to close.
For UI I'd probably choose MaskedTextBox where user can input the duration, this can be read into TimeSpan.Parse.
A Timer or a Threadpool thread can keep of or call back when due.
 
Back
Top