Seite 1 von 1

OPP VB2008

Verfasst: 05.10.2010 00:44
von Andreas21
Hallo,

Ich baue mir momentan ein Plugin System bei dem ich nur ein Pointer auf die Proceduren in der DLL bekomme.
Und sie über OOP dann benutzen kann.
In PB habe ich damit kein Problem.

Mich würde intressieren wie er in VB ausehen würde.
Ich bin bis jetzt an der umsetzung gescheitert.

Mein Plugin System ist so gedacht:

Code: Alles auswählen

Interface Plugin_Interface
  Relase()
  Version()
  Version_s()
  Hallo()
EndInterface

Structure Plugin_Structure
  Library.i
  Name.s
EndStructure

Procedure.l LoadModul(name.s)
  Protected Adresse.i, Plugin.Plugin_Structure
  Plugin\Library = OpenLibrary(#PB_Any, Name+".dll")
  Plugin\Name = Name
  If IsLibrary(Plugin\Library)
    Adresse = GetFunction(Plugin\Library, "PluginInit")
    If Adresse
      Procedurereturn CallFunctionFast(Adresse, Plugin)
    EndIf
    CloseLibrary(Plugin\Library)
  EndIf
EndProcedure

Plugin.Plugin_Interface = LoadModul("test")
If Plugin
  Plugin\Hallo()
  CloseLibrary(Plugin\Relase())
EndIf
Versuche bissel VB zu lernen.