Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Networks on February 15, 2005, 08:43 PM

Title: [Plugins] Error: ActiveX component can’t create object
Post by: Networks on February 15, 2005, 08:43 PM


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\. 
Title: Re: [Plugins] Error: ActiveX component can’t create object
Post by: Warrior on February 15, 2005, 08:51 PM
It's how Microsoft Active X DLLs work. You need to rename the project name as well.
Title: Re: [Plugins] Error: ActiveX component can’t create object
Post by: Networks on February 15, 2005, 08:54 PM
Problem solved. Thank you VERY much. I think that's retarded but alright.
Title: Re: [Plugins] Error: ActiveX component can’t create object
Post by: Warrior on February 15, 2005, 08:55 PM
Yep :P