Private Sub Load_Plugins()
Dim tmpPlugin As String
ReDim Plugins(0)
Dim i As Integer
Dim strPath As String
With frmMain
.FPluginBox.Path = (App.Path & "\Plugins")
.FPluginBox.Visible = False
For i = 0 To .FPluginBox.ListCount - 1
strPath = App.Path & "\Plugins\" & .FPluginBox.List(i) 'Register dll.
Shell "regsvr32 " & Chr(34) & strPath & Chr(34) & " -s"
Next i
End With
'Load Plugins
For i = 0 To frmMain.FPluginBox.ListCount - 1
strPath = App.Path & "\Plugins\" & frmMain.FPluginBox.List(i)
tmpPlugin = Split(frmMain.FPluginBox.List(i), ".dll")(0)
Shell "regsvr32 " & Chr(34) & strPath & Chr(34) & " -s" 'Register dll.
Set Plugins(UBound(Plugins)) = CreateObject(tmpPlugin & ".clsMain")
ReDim Preserve Plugins(UBound(Plugins) + 1)
AddC frmMain.RTB2, QBColor(2), "Loaded Plugin: " & frmMain.FPluginBox.List(i)
Next i
End Sub
I am trying to load plugins from a folder getting a list of them via filelistbox (FPluginBox) however an odd thing occurs. When I load a plugin named: 'PLUGY.dll' it loads perfectly fine but when I change the name of this dll to anything else I get an error: 'ActiveX component can't create object.' Does anyone know what I can do to fix this and have it load all the plugins perfectly fine in my folder \Plugins\.
It's how Microsoft Active X DLLs work. You need to rename the project name as well.
Problem solved. Thank you VERY much. I think that's retarded but alright.
Yep :P