Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created April 3, 2012 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumatti1/2296026 to your computer and use it in GitHub Desktop.
Save kumatti1/2296026 to your computer and use it in GitHub Desktop.
クラスモジュール
Option Explicit
Implements IUICommandHandler
Implements IUIApplication
Const E_NOTIMPL = &H80004001
Const MyButton = 30002
Private Declare Sub RtlMoveMemory Lib "Kernel32.dll" (ByVal Destination&, ByVal Source&, ByVal length&)
Private Sub IUIApplication_OnCreateUICommand(ByVal commandId As Long, ByVal typeID As Long, ByVal commandHandler As Long)
Dim tmp As IUICommandHandler
If commandId = MyButton Then
Set tmp = Me
RtlMoveMemory commandHandler, VarPtr(tmp), 4
Exit Sub
End If
Err.Raise E_NOTIMPL
End Sub
Private Sub IUIApplication_OnDestroyUICommand(ByVal commandId As Long, ByVal typeID As Long, ByVal commandHandler As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IUIApplication_OnViewChanged(ByVal viewId As Long, ByVal typeID As Long, ByVal view As Long, ByVal verb As Long, ByVal uReasonCode As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IUICommandHandler_Execute(ByVal commandId As Long, ByVal verb As Long, ByVal key As Long, ByVal currentValue As Long, ByVal commandExecutionProperties As Long)
If verb = UI_EXECUTIONVERB_EXECUTE Then
If commandId = MyButton Then
MsgBox "呼ばれた!!"
End If
End If
End Sub
Private Sub IUICommandHandler_UpdateProperty(ByVal commandId As Long, ByVal key As Long, ByVal currentValue As Long, ByVal newValue As Long)
Err.Raise E_NOTIMPL
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment