home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap16 / dlgrun4 / runaddin.cls < prev    next >
Encoding:
Text File  |  1995-07-13  |  1022 b   |  32 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "RunAddIn"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. 'Storage for the instance of VBInstance given to us in ConnectAddIn
  11. Dim ThisInstance As Object
  12. 'Storage for the menu and menuline objects created when the add-in adds its own menu
  13. 'and menulines to Visual Basic
  14. Dim RunMenuLine As Object
  15. 'Set up ionstances of the menu line Clicked() Event  Handlers
  16. Dim RunHandler As New DoDoRunRun
  17. 'Storage for the cookies that are passed back
  18. 'from ConnectEvents
  19. Dim RunConnectCookie As Long
  20.  
  21. Sub ConnectAddIn(VBInstance As Object)
  22.     Set ThisInstance = VBInstance
  23.     Set RunMenuLine = ThisInstance.AddInMenu.MenuItems.Add("Run...")
  24.     Set RunHandler.VBInstance = VBInstance
  25.     RunConnectCookie = RunMenuLine.ConnectEvents(RunHandler)
  26. End Sub
  27.  
  28. Sub DisconnectAddIn(Mode As Integer)
  29.     RunMenuLine.DisconnectEvents RunConnectCookie
  30.     ThisInstance.AddInMenu.MenuItems.Remove RunMenuLine
  31. End Sub
  32.