dcsimg
Results 1 to 8 of 8

Thread: RC5 without register it

  1. #1

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    341

    RC5 without register it

    I am interested to use the Trick's module presented at this link http://www.vbforums.com/showthread.p...it-(manifest-) and to use it to call the main library of Olaf vbRichClient5.dll without register it.
    Is it necessary to set each class of the library as below or only the classes used in the project ? Thank you.
    Code:
    RC5Lib AS Object 
    Set RC5Lib = NewObjectFromActivexDll(dllPath & "vbRichClient5.dll", "cFSO")
    "VB code is practically pseudocode" - Tanner Helland
    "When you do things right, people won't be sure you've done anything at all" - Reed Kimble

  2. #2
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    394

    Re: RC5 without register it

    See Olaf post here:

    VB6 Regfree-Usage of your own VB- and other COM-Dlls per DirectCOM-Helper:
    http://www.vbforums.com/showthread.p...rectCOM-Helper

  3. #3

  4. #4

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    341

    Re: RC5 without register it

    Quote Originally Posted by The trick View Post
    You just create the instances you need. Besides, you can use early binding too (not Object).
    Thank you for reply, Trick. I would prefer to use early binding method but unfortunately I have got an error within CreateObjectEx1 function.
    Name:  err.PNG
Views: 99
Size:  5.3 KB The code lines used are :
    Code:
    Option Explicit
    
    Private FS As vbRichClient5.cStream
    Private SB As vbRichClient5.cStringBuilder
    Private CSV As vbRichClient5.cCSV
    
    Private Sub Form_Load()
        Set FS = NewObjectFromActivexDll("C:\Windows\SysWOW64\vbRichClient5.dll", "cStream")
        Set SB = NewObjectFromActivexDll("C:\Windows\SysWOW64\vbRichClient5.dll", "cStringBuilder")
        Set CSV = NewObjectFromActivexDll("C:\Windows\SysWOW64\vbRichClient5.dll", "cCSV")
     End Sub
    "VB code is practically pseudocode" - Tanner Helland
    "When you do things right, people won't be sure you've done anything at all" - Reed Kimble

  5. #5
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,376

    Re: RC5 without register it

    The vbRichClient5.dll depends on two (not to register) satellite-dlls:
    - vb_cairo_sqlite.dll
    - and DirectCOM.dll
    It is the latter one, which (besides threading-support) also provides regfree-loading-support
    (for vbRichClient5.dll, but also for any other COM-Dll).

    So you don't need anything extra (no SxS-manifests nor other code-modules for regfree loading).

    If you want to make an existing RC5-App (or -Demo) regfree deployable,
    all you need is to drop-in a single *.bas-module into your project (e.g. name it modRegfree.bas):
    Code:
    Option Explicit
    
    'The following two Declares are used, to ensure regfree mode when running compiled...
    'For that to work, the App-Zip will need a \Bin\-Folder besides the compiled Executable, which should contain:
    'an up-to-date copy of the 3 Base-Dlls: DirectCOM.dll, vbRichClient5.dll and vb_cairo_sqlite.dll ...
    'usually copied from "C:\RC5\", where the registered version of the RC5 should reside on your Dev-Machine
    Private Declare Function LoadLibraryW Lib "kernel32" (ByVal lpLibFileName As Long) As Long
    Private Declare Function GetInstanceEx Lib "DirectCOM" (spFName As Long, spClassName As Long, Optional ByVal UseAlteredSearchPath As Boolean = True) As Object
    
    Const SubDir As String = "\Bin\" ' <- the usual "\Bin\" subdirectory (placed beside the compiled Executable)
    
    Public Property Get New_c() As cConstructor
      Static oConstr As cConstructor
      If Not oConstr Is Nothing Then Set New_c = oConstr: Exit Property
      
      If App.LogMode Then 'we run compiled - and ensure that we load the "Entry-Object" of the RC5 regfree
        LoadLibraryW StrPtr(App.Path & SubDir & "\DirectCOM.dll")
        Set oConstr = GetInstanceEx(StrPtr(App.Path & SubDir & "vbRichClient5.dll"), StrPtr("cConstructor"))
      Else 'we run in the IDE, and instantiate from a registered version of the RC5 (usually placed on: "C:\RC5\.." on your Dev-Machine)
        Set oConstr = CreateObject("vbRichClient5.cConstructor") 'load the Constructor-instance from the registered version
      End If
      Set New_c = oConstr
    End Property
    
    Public Property Get Cairo() As cCairo
      Static oCairo As cCairo
      If oCairo Is Nothing Then Set oCairo = New_c.Cairo 'ensure the static on the first run
      Set Cairo = oCairo
    End Property
    With that in place, your App will behave as before (when you run it in the IDE - using the registered version there),
    but when compiled, your App will run regfree automatically, when the following conditions are met:
    - beside your compiled executable, there needs to be a Folder named ..\Bin\
    - into that \Bin\-folder, the very same 3 RC5-Dlls you have registered on your dev-machine need to be copied into
    - make sure, that throughout your whole project-code, you've always created RC5-Objects via New_c or Cairo.
    The last point is easy to check, when you search for occurences of the searchterm: [New c] (without the brackets)

    So, when you use(d) New_c (of type cConstructor) to retrieve new RC5-Class-instances, you are fine.
    (same goes for Cairo - which is the main-constructor for the graphical stuff).

    New_c is the "root-object" (so to say) - and thus you will only have to create a single instance of it regfree,
    to be able to "create all other instances over it regfree as well".
    (that's what the code-module above ensures).

    And BTW - as soon as you have New_c available in a global Variable - you can then use it,
    to load other COM-Dlls regfree as well (your own ones) - via:
    New_c.RegFree.GetInstanceEx(PathToYourDll, ClassNameInDll)

    HTH

    Olaf

  6. #6

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    341

    Re: RC5 without register it

    Quote Originally Posted by Schmidt View Post
    The vbRichClient5.dll depends on two (not to register) satellite-dlls:
    - vb_cairo_sqlite.dll
    - and DirectCOM.dll
    (for vbRichClient5.dll, but also for any other COM-Dll).

    With that in place, your App will behave as before (when you run it in the IDE - using the registered version there),
    but when compiled, your App will run regfree automatically, when the following conditions are met:
    - beside your compiled executable, there needs to be a Folder named ..\Bin\
    - into that \Bin\-folder, the very same 3 RC5-Dlls you have registered on your dev-machine need to be copied into
    - make sure, that throughout your whole project-code, you've always created RC5-Objects via New_c or Cairo.
    The last point is easy to check, when you search for occurences of the searchterm: [New c] (without the brackets)

    So, when you use(d) New_c (of type cConstructor) to retrieve new RC5-Class-instances, you are fine.
    (same goes for Cairo - which is the main-constructor for the graphical stuff).

    New_c is the "root-object" (so to say) - and thus you will only have to create a single instance of it regfree,
    to be able to "create all other instances over it regfree as well".
    (that's what the code-module above ensures).

    And BTW - as soon as you have New_c available in a global Variable - you can then use it,
    to load other COM-Dlls regfree as well (your own ones) - via:
    New_c.RegFree.GetInstanceEx(PathToYourDll, ClassNameInDll)

    HTH

    Olaf
    Hi Olaf. Yes, I try to make a small app RC5 based (...the previous parser) and it would be useful to deploy it in a regfree way. What I tried above, using the Trick's module, was to register the vbRichClient5.dll itself (I unregistered it before for this test) but it failed both in IDE and EXE. Now, using the DirectCOM.dll to register vbRichClient5.dll I don't think it is possible as long as my code calls classes from it. So, if I understood right, for any deployment it is mandatory to have all RC5 dll's installed properly in my dev-machine. After that, a bin folder will contain always these 3 dll's + exe file (and the executable file will contain the modRegfree.bas). This bin folder can be archived and deployed (in this structure) anywhere in the target machine. What I do not understand in this scenario is why it is necessary to export vb_cairo_sqlite.dll as long as all my classes are included in vbRichClient5.dll. Other thing would be, if it is useful to have the constructor New_c as global variable why don't we declare it from beginning as, let's say Public cCstr As vbRichClient5.cConstructor ?
    "VB code is practically pseudocode" - Tanner Helland
    "When you do things right, people won't be sure you've done anything at all" - Reed Kimble

  7. #7
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,376

    Re: RC5 without register it

    Quote Originally Posted by Daniel Duta View Post
    Yes, I try to make a small app RC5 based (...the previous parser) -
    and it would be useful to deploy it in a regfree way.
    In that case, just drop-in the modRegfree.bas module-code, as shown above -
    and make sure, you don't have created RC5-classes in your own code "directly"
    (via the VB6 New Keyword) - always use New_c.SomeRC5Class instead...

    Then compile your Executable (let's say, you named it MyApp.exe).
    You MyApp.exe now sits (probably) in your Project-Folder (the Folder where your MyApp.vbp resides).

    For deployment you will now only have to create a separate (Deployment-)Folder -
    let's say under C:\MyApp\

    This Folder should now be populated (with copies) in the following way:
    C:\MyApp\
    C:\MyApp\MyApp.exe ... (from the Project-Folder, where you compiled this executable into)
    C:\MyApp\Bin\vbRichClient5.dll ... (from the Folder, where your registered RC5-version resides)
    C:\MyApp\Bin\vb_cairo_sqlite.dll ... (from the Folder, where your registered RC5-version resides)
    C:\MyApp\Bin\DirectCOM.dll ... (from the Folder, where your registered RC5-version resides)

    Now zip that MyApp-Folder up, so that in the Zip, the Root-Folder (MyApp) is still contained.
    (this way, your Users will only have to drag this MyApp-RootFolder from the Zip - e.g. to their Desktop,
    when they later "go into" that Folder, they see only MyApp.exe and \Bin\ ... so the Dlls are somewhat "hidden" and don't distract from your Executable)

    Quote Originally Posted by Daniel Duta View Post
    What I tried above, using the Trick's module, was to register the vbRichClient5.dll itself
    Just to make sure, regfree mode does *not* touch the registry at all -
    instead it loads Class-instances directly from the given Dll-location
    (in compiled Exe-mode that is, and as in our case - the Dll-location is the Bin-SubFolder, which was placed beside the Executable)

    Quote Originally Posted by Daniel Duta View Post
    So, if I understood right, for any deployment it is mandatory to have all RC5 dll's installed properly in my dev-machine.
    No, for *deployment* no registering is needed (only the correct Folder-structure needs to be there, with the RC5-Dlls in a \Bin\-Subfolder).

    Only for *development* (when you use the RC5 in the IDE, to debug and finally compile) -
    then a registered version needs to be there on your dev-machine....
    (And that registered "original-version" is usually placed in a constant location, different from any "Deployment-Bin-Folders" -
    these "Deployment-Bin-Folders" (in case you have several MyApp_1-MyApp_n-Folders) will contain only unregistered copies of the RC5-libs).

    Quote Originally Posted by Daniel Duta View Post
    After that, a bin folder will contain always these 3 dll's + exe file (and the executable file will contain the modRegfree.bas).
    This bin folder can be archived and deployed (in this structure) anywhere in the target machine.
    No, the Deployment-Folder is App-specific (with a structure, as outlined above)...
    And your Executable will sit directly below your (e.g. \MyApp\) Deployment-Folder - not in the Bin-Folder ...
    (the Bin-Folder is only for taking up the RC5- ... as well as your own ActiveX-Dlls, if you have any)

    Quote Originally Posted by Daniel Duta View Post
    What I do not understand in this scenario is why it is necessary to export vb_cairo_sqlite.dll as long as all my classes are included in vbRichClient5.dll.
    It's a dependency - and the RC5 will need it (e.g. vb_cairo_sqlite.dll also contains exports for compression with ZLib, ZStandard - and a few other helper-routines besides the obvious cairo- and sqlite-exports) - please don't leave it out - it will not make your "final Zip" significantly larger.

    And who knows - at some point in time the CSV-file-based interchange of data might switch
    to a well-standardized format (SQLite-DBs are quite common among scientists to exchange data,
    since they can be read by any WebBrowser (via Plugin), and on any device you might think of.
    Perhaps a good read in this regard (although already a little "dusty"):
    https://gobansaor.wordpress.com/2009...e-mp3-of-data/

    Quote Originally Posted by Daniel Duta View Post
    Other thing would be, if it is useful to have the constructor New_c as global variable why don't we declare it from beginning as, let's say Public cCstr As vbRichClient5.cConstructor ?
    I'd suggest to keep the name 'New_c' for that global constructor, since it resembles VBs New keyword the most (and basically does the same thing).
    But yes, instead of the global two Properties I've put into the module-code of my last post,
    you could use "normal global variables" for New_c and Cairo as well...
    But in that case, you will need to do the "inits" (as shown within the Public Property Get New_c() routine) in your Sub Main() instead.

    As the module code is currently, it will work anywhere (no matter if the project starts from Sub Main() or directly with a Startup-Form).

    HTH

    Olaf

  8. #8

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width