In the Form1_Close Sub, I'd like to be able to know if the event was fired by the AppClose keyword, the user clicking the red 'X' button or whether Windows is shutting down and has sent it a WMClose message. I'd then be able to process the close request accordingly.
You need to set a global variable eg ShutDown and initially set it to False.
Just before you use AppClose set ShutDown to True.
Also do this if the WM has been detected.
In the Close event check whether ShutDown is true or false and action accordingly.
Sure, have done that, and don't need to capture an event for something initiated by the program itself. But it could be useful to know if the program has been hidden. I'll look at that events library, thanks.