Please see my comment to the question.
You can abort initiated shutdown using the command "shutdown /a". So, programmatically,
But it cannot help you to keep the system working until your application is executed. The whole idea is wrong; and the author of the Solution 1 is right.