fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: ActiveX license

ActiveX license 1 week 6 days ago #11053

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Robert, hi Chris,

I have a ActiveX control that is used with a license key in VO, with
<oOLEControl>:CreateEmbedding(<cProgID>, [<cLicKey>]) ---> lSuccess
When moving that control to X# I have followed the recipes from the samples, but this one needs the license key passed as second parameter to CreateEmbedding in VO.
How can I pass that license string to my control object in X#?
Thank you very much!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

ActiveX license 1 week 6 days ago #11054

  Robert van der Hulst's Avatar Robert van der Hulst Offline Posts: 1244
Wolfgang,
Usually if you add an activeX to a windows form then a file Licenses.Licx will be added to your project. This will be included as resource in your project. And the ActiveX control will also persist its state including the license information in the form.resx file.
So you don't have to specify the key..
If that does not work then this is the code (in C#) that retrieves the private property of the AxHost (the host of the ActiveX control) and sets the key:

System.Reflection.FieldInfo f =
typeof(AxHost).GetField("licenseKey",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
f.SetValue(oActiveXControl, "license-here");


Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

ActiveX license 1 week 6 days ago #11055

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Robert,

thank you very much!

Now I have encountered another issue, I need to put all things together and let you know.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Last edit: by Wolfgang Riedmann.

ActiveX license 1 week 6 days ago #11056

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Robert,
we were able to make this OCX work in a C# application, and it used a lot of code to make the OCX work:
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.axEasyView1 = new AxEasyViewLib.AxEasyView();
((System.ComponentModel.ISupportInitialize)(this.axEasyView1)).BeginInit();
this.axEasyView1.Enabled = true;
this.axEasyView1.Location = new System.Drawing.Point(0, 0);
this.axEasyView1.Name = "axEasyView1";
this.axEasyView1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axEasyView1.OcxState")));
this.axEasyView1.Size = new System.Drawing.Size(796, 455);
this.axEasyView1.TabIndex = 0;
this.Controls.Add(this.axEasyView1);
((System.ComponentModel.ISupportInitialize)(this.axEasyView1)).EndInit();

Unfortunately, copying this code to my (written) class it throws an exception of type
System.Windows.Forms.AxHost+InvalidActiveXStateException

Do you have any idea where I can search? Is this in any manner combined to the license issue?

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

ActiveX license 1 week 6 days ago #11058

  Robert van der Hulst's Avatar Robert van der Hulst Offline Posts: 1244
Wolfgang,
You're most likely missing the axEasyView1.OcxState in the Resx file from the form.
Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

Last edit: by Robert van der Hulst.

ActiveX license 1 week 6 days ago #11059

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Robert,
yes, I think so. But hopefully I have a chance to do without it because in the migrated VO application there is no painted WinForms form.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1