Hi All

I have a program that uses a lowlevel hook to the keyboard.
Untill now I haven't really bothered using error handling as I try to use any errors to make changes to code instead of using a app that is able to have errors (if you know what I mean)

but with the current program I want to make sure that if there is a runtime error, the hook will be cleared so as not to mess things up on the PC.

Ive looked at some examnples and tutorials on the basics of error handling, that show a softly sfotly approach, writing handlers inrto most procedures, lots of nice errror number reporting, etc.
Is there a way to write one error handler to handle the lot and just execute one action before the program dies, without worying about all the other stuff?

EG:
vb Code:
  1. Public Sub OnError()
  2.     Call ClearWinHook
  3.     Unload
  4. End Sub

Ta in advance