Looking for code for "close on inject" function.
Title pretty much explains what I am looking for, for my first injector.

TerminateProcess//Kill the Process directly
or at the FormEditor
this->Close()//simulate close button
What about a function that closes the program after 10 seconds if a button is pressed.?
What are you coding in first of all..?
To close any program all you do is return execution to the OS from the main function ( why06 got it ). Everything you ever program will always have a main function.
return 0 will only work when you return in the main thread. use exit or terminateprocess
VB:
[highlight=vbnet]System.Threading.Thread.Sleep(10000)[/highlight]
Will cause your program to freeze if you don't run it from a seperate thread.
C++:
[highlight=c++]Sleep(10000)[/highlight]
IPC, inter process communication, get your thread to let your application know if it successfully attached and executed the procedure/function if all is good then close the injector else keep it open, While timers and on button click events are fine they are not really closing the app on a success, instead they will close app no matter what happends