Results 1 to 33 of 33

Thread: [RESOLVED] Plugin framework without DLL registering

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Resolved [RESOLVED] Plugin framework without DLL registering

    Can someone show me an example of a plugin framework which doesn't require registration of an ActiveX DLL? Thanks in advance!

    EDIT: Right after posting I've found DirectCOM Demo. I'll try to experiment with that and post here results.
    Last edited by MikiSoft; May 25th, 2015 at 02:56 PM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Okay, here is in attachment what I've done so far - I've combined DirectCOM with an example from this article, but it doesn't work with COM DLL examples created in other languages (C++, Java...). Where I'm wrong?



    edit> Attachment removed by mod. Contains compiled dll.
    Last edited by FunkyDexter; May 27th, 2015 at 09:39 PM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    Olaf Schimdt? Anyone?

  4. #4
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Plugin framework without DLL registering (DirectCOM)

    Do the C++ and Java plugins work if you go the regular RegSvr32 route? If not, maybe the runtimes are missing?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    Quote Originally Posted by jpbro View Post
    Do the C++ and Java plugins work if you go the regular RegSvr32 route?
    The Java DLL doesn't work but C++ should because it works when it's regularly registered.
    Last edited by MikiSoft; May 25th, 2015 at 03:07 PM.

  6. #6
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Plugin framework without DLL registering (DirectCOM)

    Looks like the error might be occurring in the C++ DLL itself - the GetInstance call is returning an object, but the subsequent SetHost call fails. Perhaps the plugin is expecting itself to be registered, and performing some test that is raising the error?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    You can check the source of it in "plugins" folder, because I don't know C++/Java I can't tell if that's true or not. But it acts the same as VB6 DLL so I think that it's unlikely that it does such thing.
    Last edited by MikiSoft; May 25th, 2015 at 01:32 PM.

  8. #8

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    Thanks, The trick! But can it be easier like this function (which doesn't work in this case), to not require CLSID or a TLB file to be specified (only DLL and class name)? It is very important for the plugin framework since for the program is much easier to implement a object only by knowing it's DLL location and a class name.
    Last edited by MikiSoft; May 25th, 2015 at 02:38 PM.

  10. #10

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    Doesn't work - first for "AtlSample" (C++ DLL) it displays me an error that library isn't registered, then for Java DLL it throws an error about ActiveX which can't create object, and after that for VB6 DLL it crashes.
    Last edited by MikiSoft; May 25th, 2015 at 02:41 PM.

  12. #12
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Plugin framework without DLL registering (DirectCOM)

    What is error? What is DLL? Your DLL's in my computer work correctly.
    Name:  Безымянный.jpg
Views: 744
Size:  27.8 KB


    EDIT:
    AtlSample.dll and vbplugin.dll work perfect, but javaSample_2.dll not work. Look, after registration javaSample_2.dll also not worked. If i add javaSample_2.dll in Project->References and write like this:
    vb Code:
    1. Dim iMsg    As javaSample_2.plugin
    2.  
    3. Set iMsg = New javaSample_2.plugin
    Name:  Безымянный.jpg
Views: 717
Size:  28.5 KB
    Perhaps it DLL required some DLL which not present in my computer?

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering (DirectCOM)

    Then ignore the Java DLL, it surely requires the outdated J++ runtime so I won't bother with that.

    Name:  direct.jpg
Views: 793
Size:  44.3 KB

    I'm using Windows XP SP3 with VB6 SP6. It should at least work for the VB DLL but it crashes when it tries to load it ("vbsample.dll").
    Last edited by MikiSoft; May 25th, 2015 at 03:06 PM.

  14. #14

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    What about VB6 DLL? Why it causes crash?

  16. #16

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Also do you have some function that performs registration of a COM DLL? I want to deal with such situations, if your function throws an error that library needs to be registered then to proceed with registering it and creating the object on a traditional way.

  18. #18
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Plugin framework without DLL registering

    Yes of course:
    vb Code:
    1. Option Explicit
    2.  
    3. Private Declare Function DispCallFunc Lib "oleaut32" (ByVal PPV As Long, ByVal oVft As Long, ByVal cc As Long, ByVal rtTYP As VbVarType, ByVal paCNT As Long, paTypes As Any, paValues As Any, ByRef fuReturn As Variant) As Long
    4. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As Long) As Long
    5. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
    6. Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
    7.  
    8. Private Const CC_STDCALL = 4
    9.  
    10. ' Функция регистрирует ActiveX библиотеку, Unload - выгружать библиотеку из памяти или нет
    11. ' В случае успеха возвращает True
    12. Private Function RegisterDll(Path As String, Optional ByVal Unload As Boolean = True) As Boolean
    13.     Dim hLib    As Long
    14.     Dim pAdr    As Long
    15.     Dim rRet    As Variant
    16.    
    17.     hLib = LoadLibrary(StrPtr(Path))
    18.    
    19.     If hLib = 0 Then Exit Function
    20.    
    21.     pAdr = GetProcAddress(hLib, "DllRegisterServer")
    22.    
    23.     If pAdr Then
    24.    
    25.         If DispCallFunc(0, pAdr, CC_STDCALL, vbLong, 0, 0, 0, rRet) = 0 Then
    26.        
    27.             If rRet = 0 Then RegisterDll = True
    28.        
    29.         End If
    30.        
    31.     End If
    32.    
    33.     If Unload Then FreeLibrary hLib
    34.    
    35. End Function
    36.  
    37. ' Функция снимает регистрирацию ActiveX библиотеки
    38. ' В случае успеха возвращает True
    39. Private Function DeregisterDll(Path As String) As Boolean
    40.     Dim hLib    As Long
    41.     Dim pAdr    As Long
    42.     Dim rRet    As Variant
    43.    
    44.     hLib = LoadLibrary(StrPtr(Path))
    45.    
    46.     If hLib = 0 Then Exit Function
    47.    
    48.     pAdr = GetProcAddress(hLib, "DllUnregisterServer")
    49.    
    50.     If pAdr Then
    51.    
    52.         If DispCallFunc(0, pAdr, CC_STDCALL, vbLong, 0, 0, 0, rRet) = 0 Then
    53.        
    54.             If rRet = 0 Then DeregisterDll = True
    55.        
    56.         End If
    57.        
    58.     End If
    59.    
    60.     FreeLibrary hLib
    61.    
    62. End Function

  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Thanks! Waiting for your revision of function which creates object without registration and then I shall combine them into the one.

    I have one question about the last function: Is possible to create object right after registration from memory without unloading and loading it again (using Unload = False)?
    Last edited by MikiSoft; May 25th, 2015 at 03:55 PM.

  20. #20
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Plugin framework without DLL registering

    I found bug. VB6 don't cast to Object (IDispatch) a returned value from CreateObjectEx2.
    Solve:
    vb Code:
    1. Set plugins(i) = CreateObjectEx2(CStr(tmp(i)), CStr(tmp(i)), "plugin")
    Perhaps it's new VB6 bug, if pass elements of array directly vb6 don't call __vbaCastObj because of this all called methods works with the IUnknown virtual table.
    My advise: you chose bad approach, most better if you would create single interface and all your plugins implement this interface. Therefore you just add tlb with interface definitions, and all your objects will casted with this interface. It most faster than using IDispatch implementation.
    TLB you can create into VB6 without problems as example.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Thanks for the effort! Can you show me example of that approach? All I want is to dynamically load DLLs (without knowing which ones exactly) from some directory where they will be put, so new plugins can be added without pain - just by pasting theirs DLL into that directory.

  22. #22
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: Plugin framework without DLL registering

    I wrote small example. Before you must develop a interface. For example - interface with 2 methods (call it IPluginInterface):
    vb Code:
    1. ' // This is main plugin interface.
    2. ' // All plugins must implement this interface
    3. ' // In order to create the type lybrary need set checkbox in ProjectProperties -> Remote Server Files
    4.  
    5. Option Explicit
    6.  
    7. ' // This method draw figure on form
    8. Public Function Draw( _
    9.                 ByVal frmForm As Object, _
    10.                 ByVal x As Long, _
    11.                 ByVal y As Long, _
    12.                 ByVal width As Long, _
    13.                 ByVal height As Long, _
    14.                 ByVal color As Long) As Long
    15.  
    16. End Function
    17.  
    18. ' // This method play a sound contained in dll
    19. Public Sub Play()
    20. End Sub
    Ok. Now you should compile it and then VB6 create in output folder type library with your interface.
    Next step is plugin. Now you can create in singe dll many of plugins. For example two class with implementation of IPluginInterface:
    vb Code:
    1. ' // This plugin will be draw a image and play "gun sound"
    2.  
    3. Option Explicit
    4.  
    5. Private Declare Function sndPlaySound Lib "WINMM.DLL" _
    6.                          Alias "sndPlaySoundA" ( _
    7.                          ByRef lpszSoundName As Any, _
    8.                          ByVal uFlags As Long) As Long
    9.                          
    10. Private Const SND_ASYNC   As Long = &H1
    11. Private Const SND_MEMORY  As Long = &H4
    12.  
    13. ' // Implements main interface
    14. Implements IPluginInterface
    15.  
    16. Dim Data()  As Byte
    17.  
    18. ' // Implements Draw method
    19. Private Function IPluginInterface_Draw( _
    20.                  ByVal frmForm As Object, _
    21.                  ByVal x As Long, _
    22.                  ByVal y As Long, _
    23.                  ByVal width As Long, _
    24.                  ByVal height As Long, _
    25.                  ByVal color As Long) As Long
    26.    
    27.     Dim frm As Form
    28.    
    29.     Set frm = frmForm
    30.  
    31.     frm.PaintPicture LoadResPicture(101, vbResBitmap), x, y, width, height
    32.    
    33. End Function
    34.  
    35. ' // Implements Play method
    36. Private Sub IPluginInterface_Play()
    37.  
    38.     Data = LoadResData("GUN", "CUSTOM")
    39.    
    40.     sndPlaySound ByVal 0, SND_ASYNC
    41.     sndPlaySound Data(0), SND_ASYNC Or SND_MEMORY
    42.    
    43. End Sub
    vb Code:
    1. ' // This plugin will be draw a rectangle and play "barking dog"
    2.  
    3. Option Explicit
    4.  
    5. Private Declare Function sndPlaySound Lib "WINMM.DLL" _
    6.                          Alias "sndPlaySoundA" ( _
    7.                          ByRef lpszSoundName As Any, _
    8.                          ByVal uFlags As Long) As Long
    9.                          
    10. Private Const SND_ASYNC   As Long = &H1
    11. Private Const SND_MEMORY  As Long = &H4
    12.  
    13. ' // Implements main interface
    14. Implements IPluginInterface
    15.  
    16. Dim Data()  As Byte
    17.  
    18. ' // Implements Draw method
    19. Private Function IPluginInterface_Draw( _
    20.                  ByVal frmForm As Object, _
    21.                  ByVal x As Long, _
    22.                  ByVal y As Long, _
    23.                  ByVal width As Long, _
    24.                  ByVal height As Long, _
    25.                  ByVal color As Long) As Long
    26.    
    27.     Dim frm As Form
    28.    
    29.     Set frm = frmForm
    30.  
    31.     frm.Line (x, y)-Step(width, height), color, B
    32.    
    33. End Function
    34.  
    35. ' // Implements Play method
    36. Private Sub IPluginInterface_Play()
    37.  
    38.     Data = LoadResData("BARK", "CUSTOM")
    39.    
    40.     sndPlaySound ByVal 0, SND_ASYNC
    41.     sndPlaySound Data(0), SND_ASYNC Or SND_MEMORY
    42.    
    43. End Sub
    Ok and create other dll with single class (just that check working of host):
    vb Code:
    1. ' // This plugin will be draw a circle and play "meow"
    2.  
    3. Option Explicit
    4.  
    5. Private Declare Function sndPlaySound Lib "WINMM.DLL" _
    6.                          Alias "sndPlaySoundA" ( _
    7.                          ByRef lpszSoundName As Any, _
    8.                          ByVal uFlags As Long) As Long
    9.                          
    10. Private Const SND_ASYNC   As Long = &H1
    11. Private Const SND_MEMORY  As Long = &H4
    12.  
    13. ' // Implements main interface
    14. Implements IPluginInterface
    15.  
    16. Dim Data()  As Byte
    17.  
    18. ' // Implements Draw method
    19. Private Function IPluginInterface_Draw( _
    20.                  ByVal frmForm As Object, _
    21.                  ByVal x As Long, _
    22.                  ByVal y As Long, _
    23.                  ByVal width As Long, _
    24.                  ByVal height As Long, _
    25.                  ByVal color As Long) As Long
    26.    
    27.     Dim frm As Form
    28.     Dim max As Long
    29.    
    30.     Set frm = frmForm
    31.    
    32.     If width > height Then max = width Else max = height
    33.    
    34.     frm.Circle (x + width / 2, y + height / 2), max / 2, color, , , height / width
    35.    
    36. End Function
    37.  
    38. ' // Implements Play method
    39. Private Sub IPluginInterface_Play()
    40.  
    41.     Data = LoadResData("MEOW", "CUSTOM")
    42.    
    43.     sndPlaySound ByVal 0, SND_ASYNC
    44.     sndPlaySound Data(0), SND_ASYNC Or SND_MEMORY
    45.    
    46. End Sub
    Ok. Now you have two dll with three plugins. Now you must write host-application (i use my module for work with unregister DLL):
    vb Code:
    1. Option Explicit
    2.  
    3. ' // List of interfaces
    4. Dim paths()     As String
    5. Dim plugins()   As IPluginInterface
    6. Dim plugCount   As Long
    7.  
    8. ' // Load all plugins
    9. Private Sub LoadPlugins()
    10.     Dim fso As FileSystemObject
    11.     Dim fld As Folder
    12.    
    13.     Set fso = New FileSystemObject
    14.    
    15.     lstPlugins.Clear
    16.     ' Scan plugins
    17.     Scan_ fso.GetFolder(App.path)
    18.    
    19. End Sub
    20.  
    21. ' // Scan folder (also scan sub-folders) and loading plugins
    22. Private Sub Scan_(fld As Folder)
    23.     Dim subFld  As Folder
    24.     Dim fle     As File
    25.     Dim index   As Long
    26.    
    27.     ' Check all files in folder
    28.     For Each fle In fld.Files()
    29.         ' Get extension pos in name
    30.         index = InStrRev(fle.Name, ".")
    31.        
    32.         If index Then
    33.             ' If extension is "dll"
    34.             If StrComp(Mid$(fle.Name, index + 1), "dll", vbTextCompare) = 0 Then
    35.                 ' Try load plugins
    36.                 Dim tmpObj  As IPluginInterface
    37.                 Dim clsid() As GUID
    38.                 Dim names() As String
    39.                 Dim count   As Long
    40.                
    41.                 On Error GoTo ERROR_LOADING
    42.                
    43.                 count = 0
    44.                
    45.                 ' Get all co-classes in dll (this support several plugins in one dll)
    46.                 If GetAllCoclasses(fle.path, clsid(), names(), count) Then
    47.                     ' New error handler
    48.                     On Error Resume Next
    49.                    
    50.                     Do While count
    51.                    
    52.                         Set tmpObj = CreateObjectEx(fle.path, clsid(count - 1))
    53.                        
    54.                         ' Object created and support IPluginInterface
    55.                         If Not tmpObj Is Nothing Then
    56.                             ' Add it to list
    57.                             ReDim Preserve plugins(plugCount)
    58.                             Set plugins(plugCount) = tmpObj
    59.                             ' Add path
    60.                             ReDim Preserve paths(plugCount)
    61.                             paths(plugCount) = fle.path
    62.                             ' Increment counter
    63.                             plugCount = plugCount + 1
    64.                             ' Add to list
    65.                             lstPlugins.AddItem names(count - 1)
    66.                            
    67.                         End If
    68.                        
    69.                         count = count - 1
    70.                        
    71.                     Loop
    72.                    
    73.                     On Error GoTo -1
    74.                    
    75.                 End If
    76.                                                
    77. ERROR_LOADING:
    78.                 Set tmpObj = Nothing
    79.                
    80.             End If
    81.            
    82.         End If
    83.        
    84.     Next
    85.    
    86.     ' Check sub-folders
    87.     For Each subFld In fld.SubFolders()
    88.         Scan_ subFld
    89.     Next
    90.    
    91. End Sub
    92.  
    93. ' // Draw in canvas figure which dependent from plugin
    94. Private Sub cmdDraw_Click()
    95.     ' If not selected plugin exit
    96.     If lstPlugins.ListIndex = -1 Then Exit Sub
    97.    
    98.     frmCanvas.Show
    99.     frmCanvas.Cls
    100.     ' Call method
    101.     plugins(lstPlugins.ListIndex).Draw frmCanvas, 0, 0, frmCanvas.ScaleWidth, frmCanvas.ScaleHeight, frmCanvas.ForeColor
    102.    
    103. End Sub
    104.  
    105. ' // Play sound which depended from plugin
    106. Private Sub cmdPlay_Click()
    107.     ' If not selected plugin exit
    108.     If lstPlugins.ListIndex = -1 Then Exit Sub
    109.        
    110.     ' Call method
    111.     plugins(lstPlugins.ListIndex).Play
    112.    
    113. End Sub
    114.  
    115. Private Sub Form_Load()
    116.     LoadPlugins
    117. End Sub
    118.  
    119. Private Sub Form_Unload(Cancel As Integer)
    120.     Dim index   As Long
    121.     ' Unload all libraries
    122.     For index = 0 To plugCount - 1
    123.         Set plugins(index) = Nothing
    124.         UnloadLibrary paths(index)
    125.     Next
    126.    
    127. End Sub
    I also add unloading libraries, this allow re-comple any dll without closing the host-project.

    Source code.

  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Thank you very much! I'll play with it tomorrow.

  24. #24

  25. #25
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Plugin framework without DLL registering

    Quote Originally Posted by MikiSoft View Post
    I've combined DirectCOM with an example from this article, but it doesn't work with COM DLL examples created in other languages (C++, Java...). Where I'm wrong?
    First, DirectCOM.dll can only create instances from those COM-Dlls regfree,
    which have the TypeLib "already compiled in".
    This is true for all VB6-created ActiveX-Dlls - and in most cases true for any
    MS-COM-Dlls (which are available also e.g. in the VBA and VBScript-World,
    as e.g. the Scripting.FSO, or the XML, or HTTP-HelperTools from MS...).


    The concrete C++-Dll in question (as Trick already pointed out), has an *internal*
    dependency to certain registry-entries - DirectCOM.dll cannot resolve those.

    Also (in case of other languages, which can produce "non-COM-dlls" much more
    easy than COM-Dlls) - I'd perhaps simply define a different Plugin-Interface which
    relies on Flat-Calls - and describes itself in a *.h-File.

    Anyways, for VB6 the COM-based interfaces work quite nicely - and since the
    VB6-native-Compiler produces code which is still competitive in many areas,
    I'd guess that plugin-contributions out of the VB6-corner are more likely.

    Just uploaded a small Demo into the CodeBank (the other example you linked to,
    is quite an "over-engineered-mess", really).
    http://www.vbforums.com/showthread.p...-per-DirectCOM




    Olaf

  26. #26
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Plugin framework without DLL registering

    There is also an officially sanctioned way to do this based on reg-free assembly isolation manifests by using the Microsoft.Windows.ActCtx object.

    This has several issues though. For one thing VB6 did not come with the tooling to support this and Microsoft neglected to update VB6 for this even though the feature was specifically designed for VB6 DLLs! For another the necessary library did not ship until Windows Server 2003 even though it could be redistributed to Windows XP 3 (and probably SP2)... but with XP dead the redist downloads are no longer available.

    So it is really a Vista-and-later feature (tested on Vista SP2, Windows 7 SP1, Windows Home Server 2011 SP1) and you need a manifest generating utility. You can use Microsoft's MT.EXE tool (from Vista and later Windows SDKs and recent versions of Visual Studio) but it is a little "dense" about ActiveX DLLs and leaves things such as the ThreadingModel and ProgId out of the manifest, so you have to hand-edit those in after generating it. Third party manifest makers might be a better bet, but I won't recommend one since there is no clear winner here.

    But within those limitations you can use VB6 ActiveX DLLs as "plugins" with nothing registered for runtime use. No funky 3rd party DLLs required at all.

    The bonus is that you can create completely portable VB6 applications that use "plugin" DLLs - ones that never require the end user to have admin rights at all and never touch the registry. These can be "XCopy installed" or run from USB flash drives, etc.

    But as I said, the user must be on a supported OS, not Windows XP or anything older.

  27. #27
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Plugin framework without DLL registering

    Quote Originally Posted by dilettante View Post
    The bonus is that you can create completely portable VB6 applications that use "plugin" DLLs - ones that never require the end user to have admin rights at all and never touch the registry. These can be "XCopy installed" or run from USB flash drives, etc.
    Well, the same holds true also for Applications which avoid any prior manifest-fiddling -
    and just use DirectCOM.dll.

    The Demo I've posted into the Codebank, will run without touching the registry -
    and would be XCopy-deployable (including the Plugins-Folder) from Win98 onwards.

    Quote Originally Posted by dilettante View Post
    But as I said, the user must be on a supported OS, not Windows XP or anything older.
    As said, DirectCOM.dll will work from Win98 onwards - and one can avoid special
    Manifest-creation, at the "cost" of "copying the Declaration of a simple API-call"
    (GetInstance or GetInstanceEx).

    I also don't see at the moment, how a Manifest-based solution would solve the
    "recognition and loading of a new Plugin.dll" at runtime, which is absolutely no
    problem with DirectCOM.

    Next thing is VBA-based Solutions or -Addins (which run in the context of an Office-
    Application) - Manifest-based regfree loading is not possible here - again no problem
    for DirectCOM.dll.

    Really can't understand your stance with regards to "proven tools, developed and
    maintained by fellow community-members" (waving around the "big bad 3rd-party-
    dependency"-baton) - and then recommending a 3rd-party dependency from MS
    (a vendor you seem to trust more) as an alternative which is not usable on all platforms,
    and less flexible.

    Olaf

  28. #28

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Plugin framework without DLL registering

    Thank you, Olaf! I can finally mark this thread as resolved.
    Last edited by MikiSoft; May 26th, 2015 at 04:51 AM.

  29. #29

  30. #30

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: [RESOLVED] Plugin framework without DLL registering

    Quote Originally Posted by The trick View Post
    MikiSoft, my module is not working? You seen my example?
    Of course that it works, and I forgot to say that I've chosen your approach since it doesn't require additional DLL. But I've waited for the Olaf's response because I've mentioned him and his DirectCOM in the first posts here.

  31. #31
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Plugin framework without DLL registering

    Quote Originally Posted by Schmidt View Post
    I also don't see at the moment, how a Manifest-based solution would solve the "recognition and loading of a new Plugin.dll" at runtime, which is absolutely no problem with DirectCOM.
    Normally you have something like a "plugins" folder and your application would look there for DLLs. You can certainly do this with assembly manifests as well.

    Quote Originally Posted by Schmidt View Post
    Next thing is VBA-based Solutions or -Addins (which run in the context of an Office-Application) - Manifest-based regfree loading is not possible here - again no problem for DirectCOM.dll.
    I'm not sure how we got onto Office VBA here, or why anyone here would care. But once again this is perfectly possible using assembly manifests.

    Quote Originally Posted by Schmidt View Post
    Really can't understand your stance with regards to "proven tools, developed and maintained by fellow community-members" (waving around the "big bad 3rd-party-dependency"-baton) - and then recommending a 3rd-party dependency from MS (a vendor you seem to trust more) as an alternative which is not usable on all platforms, and less flexible.
    I'm not a fan of undocumented binary libraries with convoluted pseudo-open source or no source at all. Doesn't mean I won't use them when no alternatives exist though.

    Microsoft is not a "3rd party" so I guess this must be a language barrier issue. I was suggesting use of a tool that ships as part of Windows on all supported releases. I clearly stated that for unsupported and unsafe OSs like Windows XP there are issues, and earlier than that it isn't an option at all.


    What I don't understand is your rejection of documented and fully supported proven alternatives that ship with Windows. Aren't alternatives and choice good things?

  32. #32
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Plugin framework without DLL registering

    Quote Originally Posted by dilettante View Post
    Normally you have something like a "plugins" folder and your application would look there for DLLs.
    You can certainly do this with assembly manifests as well.
    A link to a working example would've been fine - and what I meant with "at Runtime" was,
    when you start with Plugin1.dll and Plugin2.dll and then Download Plugin3.dll at runtime
    into your Plugins-Folder - how would that work out with a Manifest-based solution?

    Also for that latter case (dynamic loading of any COM-Dll in the FileSystem)
    a link to a working example would be fine.

    Quote Originally Posted by dilettante View Post
    I'm not a fan of undocumented binary libraries with convoluted pseudo-open source or no source at all.
    Doesn't mean I won't use them when no alternatives exist though.
    As for "undocumented" ... the GetInstance (or GetInstanceEx) is just a single call
    (quite similar to CreateObject - only working regfree) - not much to "document" there -
    especially not, since I gave a fully working App-example, which can load Plugins dynamically at
    runtime, already in the CodeBank:
    http://www.vbforums.com/showthread.p...-per-DirectCOM

    Now I'd really like to see the Manifest-based equivalent to that, which will not
    choke on further Plugin-Dlls, as they might come in from different Authors.

    Quote Originally Posted by dilettante View Post
    Microsoft is not a "3rd party" so I guess this must be a language barrier issue.
    I guess that's true, because the first party is always *you* as the vendor of a product,
    the second party is *your* customer - and 3rd-party is "everyone else" (in this case MS).
    http://en.wikipedia.org/wiki/Third-party_source
    In commerce, a "third-party source" means a supplier (or service provider) who is not directly controlled by either the seller (first party) or the customer/buyer (second party) in a business transaction.
    Quote Originally Posted by dilettante View Post
    I was suggesting use of a tool that ships as part of Windows on all supported releases.
    What I don't understand is your rejection of documented and fully supported proven alternatives that ship with Windows. Aren't alternatives and choice good things?
    I'm not a "militant rejecter" of what comes on a given Win-Installation, but what you offered so far
    is only hot air (solution-wise) - incorporating a manifest-based approach for *dynamic* loading
    of COM-based Plugin-Dlls would involve the creation of manifests for those (yet unknown) Dlls -
    and that can get (opposed to simply specifying a Dll-Filename and ClassName) quite "convoluted"
    (in the context of a portable App), as I see it - but as said, feel free to prove me wrong.

    Olaf

  33. #33
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Plugin framework without DLL registering

    Ok, take a look at the quicky I put together and posted as Reg-Free COM at runtime via Microsoft.Windows.ActCtx. Seems to work well enough here, tested on several Vista and later machines just fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width