Start New Discussion within our Software Development Community

Hi all, I have a few general questions that need answering:
1) Is there a way for an application to run a few final commands before it closes (this one is for all applications, not just windows)
2) Is it possible for a window to 'see' the application that sends it a message? For example, let's say that I have an application open called MyApp.exe and then I open the task manager. Then I use the task manager to kill the application, can the MyApp.exe application see the name of the process which has just sent it th e'terminate' message?
3) Can an application 'spawn' an entirely new application... Sort of like multi threading, but like making a process out of a function... (See below)

int main()
{
   //Run some code
   //call function 'NewProcess()'
  return 0;
}
void NewProcess()
{
   //Do whatever... The application that contained main() should have already terminated, leaving this as its own process
}

The last one seems a little... 'impossible', but we'll see...

Thanks much!

This question has already been answered. Start a new discussion instead.