Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15543

RC5 convert demo 6 Spline-Interaction to reg-free

$
0
0
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
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 
---------------------------

Here are the changes I made:

diff Code:
  1. commit d17d21434a4837a8d40505d994c667f8e8d31b1c
  2. Author: OldClock
  3. Date:   Tue Mar 9 12:00:47 2021 +0100
  4.  
  5.     regfree
  6.  
  7. diff --git a/Bin/DirectCOM.dll b/Bin/DirectCOM.dll
  8. new file mode 100644
  9. index 0000000..56b0412
  10. Binary files /dev/null and b/Bin/DirectCOM.dll differ
  11. diff --git a/Bin/vbRichClient5.dll b/Bin/vbRichClient5.dll
  12. new file mode 100644
  13. index 0000000..e1add5a
  14. Binary files /dev/null and b/Bin/vbRichClient5.dll differ
  15. diff --git a/Bin/vb_cairo_sqlite.dll b/Bin/vb_cairo_sqlite.dll
  16. new file mode 100644
  17. index 0000000..d95fb1d
  18. Binary files /dev/null and b/Bin/vb_cairo_sqlite.dll differ
  19. diff --git a/CairoTutorial.vbp b/CairoTutorial.vbp
  20. index 167e783..ef617fc 100644
  21. --- a/CairoTutorial.vbp
  22. +++ b/CairoTutorial.vbp
  23. @@ -1,9 +1,9 @@
  24.  Type=Exe
  25. -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\Windows\SysWow64\stdole2.tlb#OLE Automation
  26. -Reference=*\G{C79C91A4-10F5-4F71-A490-3B7915514344}#1.0#0#..\..\..\..\..\Code\RC5\vbRichClient5.dll#vbRichClient5
  27. +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
  28. +Reference=*\G{C79C91A4-10F5-4F71-A490-3B7915514344}#1.0#0#C:\windows\system32\vbRichClient5.dll#vbRichClient5
  29.  Form=fCairoDemo.frm
  30.  UserControl=ucCanvas.ctl
  31. -Module=modCairo; modCairo.bas
  32. +Module=RegFreeMod; RegFreeMod.bas
  33.  Startup="fCairoDemo"
  34.  Command32=""
  35.  Name="CairoTutorial"
  36. @@ -30,3 +30,6 @@ Unattended=0
  37.  Retained=0
  38.  ThreadPerObject=0
  39.  MaxNumberOfThreads=1
  40. +
  41. +[MS Transaction Server]
  42. +AutoRefresh=1
  43. diff --git a/CairoTutorial_regfree.exe b/CairoTutorial_regfree.exe
  44. new file mode 100644
  45. index 0000000..297c174
  46. Binary files /dev/null and b/CairoTutorial_regfree.exe differ
  47. diff --git a/RegFreeMod.bas b/RegFreeMod.bas
  48. new file mode 100644
  49. index 0000000..b272b30
  50. --- /dev/null
  51. +++ b/RegFreeMod.bas
  52. @@ -0,0 +1,30 @@
  53. +Attribute VB_Name = "RegFreeMod"
  54. +Option Explicit
  55. +
  56. +'The following two Declares are used, to ensure regfree mode when running compiled...
  57. +'For that to work, the App-Zip will need a \Bin\-Folder besides the compiled Executable, which should contain:
  58. +'an up-to-date copy of the 3 Base-Dlls: DirectCOM.dll, vbRichClient5.dll and vb_cairo_sqlite.dll ...
  59. +'usually copied from "C:\RC5", where the registered version of the RC5 should reside on your Dev-Machine
  60. +Private Declare Function LoadLibraryW Lib "kernel32" (ByVal lpLibFileName As Long) As Long
  61. +Private Declare Function GetInstanceEx Lib "DirectCOM" (spFName As Long, spClassName As Long, Optional ByVal UseAlteredSearchPath As Boolean = True) As Object
  62. +
  63. +Const SubDir As String = "\Bin" ' <- the usual "\Bin" subdirectory (placed beside the compiled Executable)
  64. +
  65. +Public Property Get New_c() As cConstructor
  66. +  Static oConstr As cConstructor
  67. +  If Not oConstr Is Nothing Then Set New_c = oConstr: Exit Property
  68. +  
  69. +  If App.LogMode Then 'we run compiled - and ensure that we load the "Entry-Object" of the RC5 regfree
  70. +    LoadLibraryW StrPtr(App.Path & SubDir & "\DirectCOM.dll")
  71. +    Set oConstr = GetInstanceEx(StrPtr(App.Path & SubDir & "vbRichClient5.dll"), StrPtr("cConstructor"))
  72. +  Else 'we run in the IDE, and instantiate from a registered version of the RC5 (usually placed on: "C:\RC5\.." on your Dev-Machine)
  73. +    Set oConstr = CreateObject("vbRichClient5.cConstructor") 'load the Constructor-instance from the registered version
  74. +  End If
  75. +  Set New_c = oConstr
  76. +End Property
  77. +
  78. +Public Property Get Cairo() As cCairo
  79. +  Static oCairo As cCairo
  80. +  If oCairo Is Nothing Then Set oCairo = New_c.Cairo 'ensure the static on the first run
  81. +  Set Cairo = oCairo
  82. +End Property
  83. diff --git a/modCairo.bas b/modCairo.bas
  84. deleted file mode 100644
  85. index db4c2e7..0000000
  86. --- a/modCairo.bas
  87. +++ /dev/null
  88. @@ -1,15 +0,0 @@
  89. -Attribute VB_Name = "modCairo"
  90. -Option Explicit
  91. -
  92. -'Just to ensure "global visibility" of the New_c Constructor-
  93. -'Variable as well as the "Cairo-Entry-Instance"-Variable
  94. -'(throughout our Demoprojects Code-Modules)
  95. -Public New_c As New cConstructor
  96. -
  97. -Public Property Get Cairo() As cCairo
  98. -Static statCairo As cCairo
  99. -  If statCairo Is Nothing Then Set statCairo = New_c.Cairo
  100. -  Set Cairo = statCairo
  101. -End Property
  102. -
  103. -

I suppose I might need to change Private CPs() As cControlPoint but don't know how. Could someone help me out?
Attached Files

Viewing all articles
Browse latest Browse all 15543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>