One way would be:
VB Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
Timer1.Enabled = False: Timer1.Enabled = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False: Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Unload Me
End Sub
the form's KeyPreview property needs to be set to true.
That will only work well if you have a lot of the form exposed (i.e. not covered with controls so the MouseMove event doesn't fire).
Alternatively you could use GetCursorPos API on a timer to check the mouse position.