I finally had to think out of the box and discovered that the license message was just wrong and quite misleading. I was attempting to load a non-existent control! Sorry for the bother. My confidence with COM Interop (regarding activeX that is) increases a bit! My embarrassment increases as well!! <g>
jule -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Beck,Mikhail Sent: Friday, July 04, 2003 3:49 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] interop with activeX and license key issues I had a similar problem a while ago. I had to use an OCX in a service app. When you reference a COM control in VS.Net it normally creates an instance through CoCreateInstance (although I am not sure about Windows Forms). I have ended up making a small wrapper that uses IClassFactory2: LPCWSTR _szLicKey = L"{E216CF79-5AB9-4C50-BBCE-068494FA89C1}{5C98D5BC-3F50-A76C-BBBE-0203384 024A E}"; CComPtr<IMyControlInterface> pControl; CComPtr<IClassFactory2> pFactory; HRESULT hr = CoGetClassObject( CLSID_MyControl, CLSCTX_SERVER, NULL, IID_IClassFactory2, (void **)&(pFactory.p) ); if ( SUCCEEDED( hr ) ) hr = pFactory->CreateInstanceLic( NULL, NULL, IID_IMyControlInterface, CComBSTR( _szLicKey ), (void **)&(pControl.p) ); You can do this through the Interop as well, I just found it easier to resort to old good ATL. Mikhail -----Original Message----- From: Julia Lerman [mailto:[EMAIL PROTECTED] Sent: 04 July 2003 04:23 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] interop with activeX and license key issues This seems to be the only place to turn for COM Interop problems (outside of directly pestering a few select people). So thanks in advance for any help. I have posted this on the ActiveX section of the windowsforms.com forums as well. I will share anything I learn here in that spot. ------------------ I basically solved the bizarre problem of dealing with license keys for my own ActiveX controls when using them in my winforms application. But I am having a strange problem. I have about 20 controls in an ocx file that I access dynamically from my winforms app. This via an AxIMP generated dll. When I use the controls on my dev machine, all is well. (but of course!! <g>) When I deploy them to another box (I have tried two others so far with similar results), all but one of the controls work. On that one, a message box pops up to say "you don't have a license to use this activex control." I have triple checked the license key that I have tucked away in an embedded resource file. Plus there is a VB app that uses the same controls from literally the same ocx file and it can access that particular activex control on these machines. I know COM interop is a wily beast, but has anybody seen behavior like this and have any ideas what I should be looking at to fix it? Thanks much. Julie Julia Lerman VTdotNet User Group Leader www.vtdotnet.org <http://www.vtdotnet.org/> INETA User Group Relations Committee Co-Chair <http://www.ineta.org/> www.INETA.org Microsoft MVP _____________________________________________________________________ This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com _____________________________________________________________________ This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com
