clsplugininterface.cls

来自「这是一个完美版本的的超强文件编辑器,支持各种程序的语法高亮,支持插件和宏录制,支」· CLS 代码 · 共 62 行

CLS
62
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsPluginInterface"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'This class wil have be be the stnadard object you use to get the plugin going.
' You can edd extra functions the perform other things, like
' KillPlugin, HidePlugin etc etc. The basic rule will just be that these functions
' must be known to the host app. How else will the host app know how to
' get the plugin going ?

' Note that we pass the host app's form into this object. Once we
' got the host app's form, we have access to the host app's form
' and we cann access and manipulate all public objects on that
' form. An Example of why we do this is : Think of a database application.
' The DB application uses ADO. You want to write a pluin that would
' calculate the total number of characters in a record set. So,
' the ADO RECORDSET (Resultset) object must be public on the host
' form. By passing the form to the plugin, the plugin can get to the ADO
' object and do the calculations. Thus, the plugin is specific for
' a certain form, becuase it needs to know what goes on on that form.


' Got that ?



Public Function Run(FormX As Object) As String
'This is the entry point to run the plugin. The Host app will have
' to call this function in order to get the plugin started.
' In addition to that, the host form must pass itself as an object
' to give the plugin access to the host applications objects and
' controls. So, the plugin will be able to modify/use any public
' objects on the host form...nice eh ?
On Error GoTo errtrap
    frmMain.Show
    frmMain.Text1 = FormX.Caption
    Set frmMain.objHost = FormX
    Run = vbNullString
Exit Function
errtrap:
    Run = Err.Description
End Function

Public Function Identify() As String
'This function is one of the interface calls to the plugin. It allows the host to get
' a description of the plugin. This value could then be used
' in the host's menu.

  Identify = "Sample Plugin version " & App.Major & "." & App.Minor & "." & App.Revision

End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?