If you register multiple hot keys for an application (I had 4), when you call the Clear method (which autofires at Class_Terminate) it generates a RTE 9 - Subscript Out of Range. This is because the for loop goes from 1 to 4, but the array is redimmed each time a key is unregistered.
This can be fixed by changing the Clear method to
Public Sub Clear()
Dim i As Long
' Remove all hot keys and atoms:
Do While m_iAtomCount > 0
UnregisterKey m_tAtoms(m_iAtomCount).sName
Loop
' Stop subclassing:
If (m_hWnd <> 0) Then
DetachMessage Me, m_hWnd, WM_HOTKEY
DetachMessage Me, m_hWnd, WM_DESTROY
m_hWnd = 0
End If
End Sub
|