Man, just write a service if you need something the user cannot close. Even if the user closes the "client" part (e.g. a visible
GUI), the service will continue to run. Let's assume for a second that you succeed in achieving your goal of an application that cannot be closed. No application is bug-free. Once the user encounters a bug and your application prevents the user from closing it, you'll have a bunch of angry users. Besides, with a hook such as the one you describe it's likely that you introduce more potential issues into the user's session ... i.e. affecting other processes as well.
I think you should elaborate on the problem you're trying to solve, because so far it indeed sounds iffy. So let's hear ...