VC++ License Issue - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Viewer3ds and Ab3d.Reader3ds (https://forum.ab4d.com/forumdisplay.php?fid=5) +--- Thread: VC++ License Issue (/showthread.php?tid=67) |
VC++ License Issue - YGT - 12-28-2010 Hi, I have created an ActiveX using ab3d.reader3ds library. This activeX I am using in a (UnManged)VC++ application, I have added the "license.licx" in VC++ app, and it seems that it complies&embed the license in the vc++App successfully, as vc++ output windows shows. But when I execute this application on the user system. It fails showing following message that "The current application is using an unlicsed version of Ab3d.Reader3ds.evaluation" I am attaching the error message also "Eavaluation Error.JPG". I am also attaching the reource compiler settings lc.exe /nologo /target:"TestActiveX.exe" /outdir:"Release" /i:"c:\Program Files\Ab3d.PowerToys\bin\CodeSigned\Ab3d.PowerToys.dll" /i:"c:\Program Files\Ab3d.Reader3ds\bin\CodeSigned\Ab3d.Reader3ds.dll" Please let me know am I embedding the license file properly in VC++? Please reply us as soon as possible, it is very critical for us. Thanks YGT RE: VC++ License Issue - abenedik - 12-28-2010 Hi, Let me first explain how the licensing works for managed .Net applications (my libraries are using a standard .Net licensing mechanism): When you embed license.licx file into the project, the compiler checks the file and creates an instances of the classes that are written in license.licx file. The instances are created with a special licensing context - so when the class is created it knows if it was created in compile time or in runtime. When it is created in compile time than the licensing code creates a runtime license key (different from the installed license key) and uses a special .Net method to save the runtime license key. Saving the license key tells compiler to embed the license key into the embedded resources of the project. So when the project is compiled its dll or exe will contain a special *.licenses embedded resource with license keys. This can be checked with Reflector - see the attached image (example for ReaderSvg library) When the project is run, the licensing code is instantiated in runtime context and then it checks if the runtime license is present in the embedded resources (if it cannot find it in the executing assembly, than it searches the resources in the assemblies present in the current App Domain). When the embedded license is found it is checked and when the license is correct the library is licensed to run. This way the application can be distributed to clients that do not have the library installed. If the embedded license is not found, the license needs to be installed on the computer. NOTE: This only applies to using commercial license. When using evaluation license, the libraries will only work on computers where it is installed. Now to your unmanaged solution: I am almost sure that linking license.licx file will not invoke the licensing code and will therefore not embed the license code (but I am not an expert for unmanaged code so I cannot tell for sure). I would advise you to create a new managed class library that is referencing Ab3d.PowerToys and Ab3d.Reader3ds and that is having an license.licx file. When you will compile the project it will contain the embedded license. The new class library should than be ready to be used for your unmanaged ActiveX. There is another issue that you should fix before it will work: From the screenshot you have posted I see, that you are using an evaluation version of Reader3ds - it cannot use embedded licenses. Note that when installing the commercial version, the evaluation version is not automatically uninstalled. If you have manually changed the folder of installations to the same folder, than you might have a wrong version installed. I would advice you that you uninstall evaluation and commercial versions, just in case manually delete the folders from program files and than install the commercial version again. I hope my recommendation will help you. RE: VC++ License Issue - YGT - 12-28-2010 Thanks very the much for the prompt reply. Now about the issue. I have installed the way you have asked to install my licensed version of dll's. After that I have created a DotNet-C# application using the Dll's. But this application is also giving the same error message when executed on the client machine. I am attaching the C#-Project herewith with the license embedded in it. I have also checked with the reflector that the license is embedded in it. Please let me know what I am missing in this. Thanks YGT (12-28-2010, 11:33 AM)YGT Wrote: Hi, RE: VC++ License Issue Thanks very the much for the prompt reply.:) Now about the issue. I have installed the way you have asked to install my licensed version of dll's. After that I have created a DotNet-C# application using the Dll's. But this application is also giving the same error message when executed on the client machine. I am attaching the C#-Project herewith with the license embedded in it. I have also checked with the reflector that the license is embedded in it. Please let me know what I am missing in this. Thanks YGT RE: VC++ License Issue - abenedik - 12-28-2010 Hi, I have tried your solutions and found that you were very close to the solution. All you need to do is to add also PowerToys to your license.licx file. It should have the following content: Ab3d.Reader3ds, Ab3d.Reader3ds Ab3d.Common.PowerToys.LicenseInstaller, Ab3d.PowerToys This will call the licensing code for both libraries. Please also check that you are not using the evaluation version. This can be also checked by assembly versions: Ab3d.Reader3ds - commercial: 7.0.4000.21414 evaluation: 7.0.4000.27467 Ab3d.PowerToys - commercial: 2.0.3999.32160 evaluation: 2.0.3999.32294 With the changed license.licx file your project will work on another computer (I have tried it) I will send you my project as a private message (to not distribute the commercial version around). When trying your sample I have found that there are some issues when WPF is hosted inside Win Forms - for example the mouse camera controller does not get keyboard modifiers (shift, control, alt) and mouse wheel events. It looks like this has something to do with focus. When Browse button is clicked the focus goes to Win forms button - when you than click tab to move focus to WPF host, the keyboard and mouse wheel works. I will investigate this a little bit more and tell you what I have found. RE: VC++ License Issue - YGT - 12-29-2010 Hi Abenedik, Thanks very much it worked in Un-Managed as well as in Manged app, after adding the mentioned contents in the License file. Thanks very much for the solution. About the second issue related to that mouse cameracontroller does not get keyboard modifiers (shift, control, alt) and mouse wheel events. We have added work around in our host application by handling these message and its working fine. Thanks Very Much YGT RE: VC++ License Issue - abenedik - 12-29-2010 Hi, I am glad that this solved your issues. I understand that the current documentation that comes with the libraries is not very clear for cases where two libraries are licensed. I will improve this for further releases. You mentioned that you have solved the issues with keyboard and mouse events when hosting WPF in Win Forms. I and probably some other users would be very interesting to find out what needs to be done to solve the issues. I would kindly ask you if you can share your solution with posting some hints, code snippets or some links that can help to solve those issues. |