Yes to all.
It might help you to understand that processes don't actually "run" in Windows. Threads run. Every process has at least one thread. So, the real questions are:
- can executing code create another thread? Yes.
On Windows this is done with the CreateThread API, or one of its cousins. The long version would be "can code that's running in the context of a thread create another thread?" Sure, but since all code runs in the context of some thread, there's no need for the extra verbiage. CreateThread takes an argument that is the address of the function that becomes the top-level function for the new thread - essentially the new thread's "main".
- can executing code create another process? Yes.
Similarly to previous: when you're running in the context of a thread, you're also running in the context of the process that owns the thread. So, yes, there is a CreateProcess API and you can use it to create another process.
You'll also be, automatically and without further effort, creating a thread in your new process... because (since processes don't run) a process without a thread can't do anything. That first thread in the new process will start running the program's "main" function - main() or WinMain() or whatever.
for ques. 1 and 4 answer is YES. – Harry Joy – 2011-02-02T06:04:33.437