home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Plugin_Fra2028191112006.psc / Form1.frm < prev    next >
Text File  |  2006-10-28  |  3KB  |  111 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fest Einfach
  4.    Caption         =   "Plugin Host"
  5.    ClientHeight    =   3000
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4680
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3000
  13.    ScaleWidth      =   4680
  14.    StartUpPosition =   3  'Windows-Standard
  15.    Begin VB.CommandButton cmdRefresh 
  16.       Caption         =   "Refresh"
  17.       Height          =   315
  18.       Left            =   383
  19.       TabIndex        =   2
  20.       Top             =   2550
  21.       Width           =   1440
  22.    End
  23.    Begin VB.CommandButton cmdLoad 
  24.       Caption         =   "Execute"
  25.       Height          =   315
  26.       Left            =   2858
  27.       TabIndex        =   1
  28.       Top             =   2550
  29.       Width           =   1440
  30.    End
  31.    Begin VB.ListBox lstPlugins 
  32.       Height          =   2010
  33.       Left            =   233
  34.       TabIndex        =   0
  35.       Top             =   300
  36.       Width           =   4215
  37.    End
  38.    Begin VB.Label Label1 
  39.       Caption         =   "Plugins:"
  40.       Height          =   240
  41.       Left            =   225
  42.       TabIndex        =   3
  43.       Top             =   75
  44.       Width           =   840
  45.    End
  46. End
  47. Attribute VB_Name = "Form1"
  48. Attribute VB_GlobalNameSpace = False
  49. Attribute VB_Creatable = False
  50. Attribute VB_PredeclaredId = True
  51. Attribute VB_Exposed = False
  52. Option Explicit
  53.  
  54. Implements rmplugin_defs.IRMPluginHost
  55.  
  56. Private clsPluginLoader As PlugInLoader
  57.  
  58. Private Sub cmdLoad_Click()
  59.     Dim clsPlugin   As rmplugin_defs.IRMPlugin
  60.  
  61.     Set clsPlugin = clsPluginLoader.CreatePlugin(lstPlugins.ListIndex)
  62.     If clsPlugin Is Nothing Then
  63.         MsgBox "Could not load the Plugin!", vbExclamation
  64.         Exit Sub
  65.     End If
  66.  
  67.     ' reference to us, so the plugin can inform us about its state
  68.     clsPlugin.InitPlugin Me
  69.  
  70.     ' execute the plugin
  71.     clsPlugin.DoAction rmshow_modal
  72. End Sub
  73.  
  74. Private Sub cmdRefresh_Click()
  75.     Dim i           As Long
  76.     Dim clsPlugin   As rmplugin_defs.IRMPlugin
  77.  
  78.     clsPluginLoader.FindPlugins
  79.  
  80.     For i = 0 To clsPluginLoader.PluginCount - 1
  81.         Set clsPlugin = clsPluginLoader.CreatePlugin(i)
  82.         lstPlugins.AddItem clsPlugin.Name & " - " & clsPlugin.Description
  83.     Next
  84. End Sub
  85.  
  86. Private Sub Form_Load()
  87.     Set clsPluginLoader = New PlugInLoader
  88.  
  89.     ' the interface the plugins have to implement
  90.     Set clsPluginLoader.Interface = New rmplugin_defs.IRMPlugin
  91. End Sub
  92.  
  93. ''''''''''''''''''''
  94. ''' Plugin Host
  95. ''''''''''''''''''''
  96.  
  97. Private Property Get IRMPluginHost_OwnerFormHandle() As Long
  98.     IRMPluginHost_OwnerFormHandle = Me.hWnd
  99. End Property
  100.  
  101. Private Sub IRMPluginHost_RaiseFinished(plugin As rmplugin_defs.IRMPlugin)
  102.     If plugin.Result = rmres_success Then
  103.         MsgBox "Plugin " & plugin.Name & " is finished." & vbCrLf & _
  104.                "Result: " & plugin.Value, _
  105.                vbInformation
  106.     Else
  107.         MsgBox "Plugin " & plugin.Name & " was aborted.", _
  108.                vbExclamation
  109.     End If
  110. End Sub
  111.