Guys,
I have got a copy of the Syntax Edit OCX control from CodeJock:
http://www.codejock.com/downloads/samples/syntaxedit.asp (http://www.codejock.com/downloads/samples/syntaxedit.asp)
For my needs it is a nice control and works well enough. The problem is that I have to embed license information in code. On my dev PC this is a text (.LIC) file located in the same folder as the OCX itself. When this is present, as you would expect, there is no need to utilise the license key in my code.
But on creating an install pakage, I have had big issues getting the control to work correctly (naturally including the LIC file in the same folder as the OCX on the client machine works but is against license terms).
I know that the main interface to the control exposes a property to an interface to set the license key information, as below:
Interface IDBIND DSyntaxEdit
Member Get DataManager <2> () As SyntaxEditDataManager ' <dispinterface>
Member Get GlobalSettings <33> () As ISyntaxEditGlobalSettings ' <dispinterface>
The issue (at least in my mind) is that the instance of DSyntaxEdit has been created thus:
Global SynEdit As DSyntaxEdit
Let SynEdit = OC_GetDispatch(HWND_FORM3_OCXCONTROL1)
If IsObject(SynEdit) Then
...Initialize stuff etc...
End If
On the client machine, SynEdit is never an instantiated object for me to then get a reference to the GlobalSettings property to set the license key. Any ideas ?
I have created an instance of this interface separately using:
Global LIC As ISyntaxEditGlobalSettings
Let LIC = NewCom "Codejock.SyntaxEditGlobalSettings.15.3.1"
But this is 'in isolation' and has no reference to the main Syntax Edit class - if that makes sense.
Would be very appreciative of any and all ideas / suggestions :-[
Thanks in advance,
Steve.
Hi Steve,
Have you tried entering the license key information in the property called "LicenseKey" for the OCX? That should pass the information to the OCX when it is created.
Hi,
Thanks for the response. I tried that but the license info is over multiple lines and believe that only the first made it into the property text box from memory. I shall give it a go through code. This is from their site about performing this:
http://www.codejock.com/support/articles/com/general/g_3.asp (http://www.codejock.com/support/articles/com/general/g_3.asp)
Private Sub Form_Initialize()
CommandBarsGlobalSettings.License = "CommandBars Control Copyright (c) " & _
"2003-2006 Codejock Software" & vbCrLf & "PRODUCT-ID: " & _
"Codejock.CommandBars.ActiveX.v10.20" & vbCrLf & _
"VALIDATE-CODE: XXX-XXX-XXX-XXX"
End Sub
So, as it turns out, I have created an instance of the GlobalSettings class and set the LIC info:
Global LIC As ISyntaxEditGlobalSettings
Let LIC = NewCom "Codejock.SyntaxEditGlobalSettings.15.3.1"
Object Let LIC.Licens = License
.......
Then instantiate the control itself:
Global SynEdit As DSyntaxEdit
Let SynEdit = OC_GetDispatch(HWND_FORM3_OCXCONTROL1)
If IsObject(SynEdit) Then...Initialize stuff etc...End If
Now, if I use Object Get SynEdit.GlobalSettings.Lic to wStr, it returns what I have passed into the earlier 'separate' global settings reference but still no dice. All I can think of is that I have not set the string properly with Unicode (eg questioning if I should be using $$CrLf instead of $CrLf) - but if 'License' is declared as wString - that 'conversion' would happen automatically ?
Happy to try anything at this stage ! Thanks in advance,
Steve.
hmmm.... interesting problem. Where is it that you are setting the license key in the global settings? In WM_CREATE for the Form? If yes, then that could be a problem because the OCX would have already been created prior to you setting the global setting in WM_CREATE. Maybe try putting your code in FF_WINMAIN and see if that makes a difference.
Paul,
Yes, in WM_CREATE... Good thinking, I'll give that a go. I should have thought of that !
Thanks for your continued assistance.
Steve.
Paul,
Confirming that that was the issue and placing the registration code in WINMAIN sorted the problem. Woods, trees etc !
Thanks again for the support.
Steve.
That's great news! Happy to hear that it is working now. Looks like a pretty good editing control.