Hey
I am trying to learn how to code and deploy a project using RC5 reg-free, and to do this I am converting CairoTutorial > 6 Spline-Interaction.
I read through this post from 2014: https://www.vbforums.com/showthread....=1#post4801965
and I used this newer and leaner module from 2019: https://www.vbforums.com/showthread....=1#post5408735
Folder structure is as described in those threads, with a \Bin\ folder alongside the compiled executable and the three dlls in that bin folder.
When I copy the compiled executable and Bin folder to a clean installation of Windows XP or Windows 10, it throws this error when it gets to
Here are the changes I made:
I suppose I might need to change Private CPs() As cControlPoint but don't know how. Could someone help me out?
I am trying to learn how to code and deploy a project using RC5 reg-free, and to do this I am converting CairoTutorial > 6 Spline-Interaction.
I read through this post from 2014: https://www.vbforums.com/showthread....=1#post4801965
and I used this newer and leaner module from 2019: https://www.vbforums.com/showthread....=1#post5408735
Folder structure is as described in those threads, with a \Bin\ folder alongside the compiled executable and the three dlls in that bin folder.
When I copy the compiled executable and Bin folder to a clean installation of Windows XP or Windows 10, it throws this error when it gets to
Code:
Set CPs(i) = ucCanvas1.ControlPoints.Add("P" & i, i * 80 + 40, 100 + Rnd * 300, vbBlue)
Code:
---------------------------
CairoTutorial
---------------------------
Run-time error '91':
Object variable or With block variable not set
---------------------------
OK
---------------------------
diff Code:
commit d17d21434a4837a8d40505d994c667f8e8d31b1c Author: OldClock Date: Tue Mar 9 12:00:47 2021 +0100 regfree diff --git a/Bin/DirectCOM.dll b/Bin/DirectCOM.dll new file mode 100644 index 0000000..56b0412 Binary files /dev/null and b/Bin/DirectCOM.dll differ diff --git a/Bin/vbRichClient5.dll b/Bin/vbRichClient5.dll new file mode 100644 index 0000000..e1add5a Binary files /dev/null and b/Bin/vbRichClient5.dll differ diff --git a/Bin/vb_cairo_sqlite.dll b/Bin/vb_cairo_sqlite.dll new file mode 100644 index 0000000..d95fb1d Binary files /dev/null and b/Bin/vb_cairo_sqlite.dll differ diff --git a/CairoTutorial.vbp b/CairoTutorial.vbp index 167e783..ef617fc 100644 --- a/CairoTutorial.vbp +++ b/CairoTutorial.vbp @@ -1,9 +1,9 @@ Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\Windows\SysWow64\stdole2.tlb#OLE Automation -Reference=*\G{C79C91A4-10F5-4F71-A490-3B7915514344}#1.0#0#..\..\..\..\..\Code\RC5\vbRichClient5.dll#vbRichClient5 +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation +Reference=*\G{C79C91A4-10F5-4F71-A490-3B7915514344}#1.0#0#C:\windows\system32\vbRichClient5.dll#vbRichClient5 Form=fCairoDemo.frm UserControl=ucCanvas.ctl -Module=modCairo; modCairo.bas +Module=RegFreeMod; RegFreeMod.bas Startup="fCairoDemo" Command32="" Name="CairoTutorial" @@ -30,3 +30,6 @@ Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/CairoTutorial_regfree.exe b/CairoTutorial_regfree.exe new file mode 100644 index 0000000..297c174 Binary files /dev/null and b/CairoTutorial_regfree.exe differ diff --git a/RegFreeMod.bas b/RegFreeMod.bas new file mode 100644 index 0000000..b272b30 --- /dev/null +++ b/RegFreeMod.bas @@ -0,0 +1,30 @@ +Attribute VB_Name = "RegFreeMod" +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 diff --git a/modCairo.bas b/modCairo.bas deleted file mode 100644 index db4c2e7..0000000 --- a/modCairo.bas +++ /dev/null @@ -1,15 +0,0 @@ -Attribute VB_Name = "modCairo" -Option Explicit - -'Just to ensure "global visibility" of the New_c Constructor- -'Variable as well as the "Cairo-Entry-Instance"-Variable -'(throughout our Demoprojects Code-Modules) -Public New_c As New cConstructor - -Public Property Get Cairo() As cCairo -Static statCairo As cCairo - If statCairo Is Nothing Then Set statCairo = New_c.Cairo - Set Cairo = statCairo -End Property - -
I suppose I might need to change Private CPs() As cControlPoint but don't know how. Could someone help me out?