licensing mscomm32.ocx from C#

G

Guest

I wrote a wrapper class around mscomm32.ocx in C# and I have a problem deploying it to a PC without IDE installed. I am getting an error message about the class not being licensed. I found some references to that in MS knoweldge base - they claim I need to add the license manually to the cotrol, at run time

Here is what my class is like

I added reference to mscomm32.ocx in project and then created my class
I purposely use MSCommClass instead of AxMSCommLib.AxMSComm, because I don't need all the members for the .NET control. All I need is comm functionality

How can I add the license at run time
class MyCom

protected MSCommLib.MSCommClass m_oCommPort = null
public MyComm(

// ADD LICENSE CODE HERE????
m_oCommPort = new MSCommClass(); // causes an exceptio



Any help is greatly appreciated
Thanks a lot
V

P.S. Here is a code snippet I found, that is semi-useful, I just don't know what to make of it: seems like it need AxComm, and not MSComm, and even for AxComm, I am not sure how to use it

System.Reflection.FieldInfo f =
typeof(MSCommLib.MSCommClass).GetField("licenseKey",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)

f.SetValue(this, "gnvlslnjskvlmlgnnimh")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top