Have a look at this thread, may be an issue for you depending upon which version of ArcGIS you are using.
I cobbled some code together in VBA, this may help you. I never quite got it to stop the tool bar opening but the event is captured.
myClass that implements ICustomizationFilter
Implements ICustomizationFilter
Private Function ICustomizationFilter_OnCustomizationEvent(ByVal custEventType As esriCustomizationEvent, ByVal eventCtx As Variant) As Boolean
If custEventType = esriCEInvokeCommand Then
Let ICustomizationFilter_OnCustomizationEvent = False
Debug.Print eventCtx
End If
End Function
A module setting the filter:
Public x As myClass
Public Sub test()
Set x = New myClass
Dim pApp As IApplication
Set pApp = Application
pApp.LockCustomization "fred", x
End Sub