سؤال

I have an OCX library called CyberSc.ocx.

Running the following command adds one entry to the COM tab of my Add References dialog box:

regsvr32 CyberSc.ocx

My Reference Manager

When I add to my project, I get this:

Added

My colleague has two entries on his COM tab, both called CyberSc ActiveX Control Module, and when he adds one he gets a COM reference to Interop.CYBERSCLib.dll for the first entry and a COM reference to AxInterop.CYBERSCLib.dll for the second entry.

The COM library which I am able to add (the Interop one) appears in my *.proj file like so:

<COMReference Include="CYBERSCLib">
  <Guid>{5C31C2B3-955D-11D4-B3BB-00D0B77FDB6E}</Guid>
  <VersionMajor>1</VersionMajor>
  <VersionMinor>0</VersionMinor>
  <Lcid>0</Lcid>
  <WrapperTool>tlbimp</WrapperTool>
  <Isolated>False</Isolated>
  <EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>

My colleague, who is also able to add the second library (the AxInterop one), has this in the *.proj file for the reference:

<COMReference Include="AxCYBERSCLib">
  <Guid>{5C31C2B3-955D-11D4-B3BB-00D0B77FDB6E}</Guid>
  <VersionMajor>1</VersionMajor>
  <VersionMinor>0</VersionMinor>
  <Lcid>0</Lcid>
  <WrapperTool>aximp</WrapperTool>
  <Isolated>False</Isolated>
</COMReference>

It's the same GUID on both of our machines, and also on both references which makes me think they are both using the one COM library, just with two different wrappers. Would this be correct?

Am I correct in thinking that my computer contains the tlbimp wrapper tool, so I can use this with COM library 5C31C2B3-955D-11D4-B3BB-00D0B77FDB6E, but my computer does not contain the aximp wrapper tool, so I can't use this with the same library, however my colleagues computer contains both wrapper tools? If so, how do I add the aximp wrapper tool to my computer?

We can only find one *.OCX file on either of our systems. Can anybody shed some light on what is going on here? How do I add an Interop and AxInterop COM library to the COM tab of the Reference Manager for a Visual Studio project from only one *.ocx file?

Thanks

هل كانت مفيدة؟

المحلول

Just incase anybody stumbles across this in the future, the answer is pretty simple.

  • You need to use regsvr32 to register the OCX file as a COM library as mentioned above
  • Add this one COM library to your project (from the COM tab)
  • Add a Windows Form to your project
  • In the designer, right click inside the toolbox and click Choose Items...
  • Click on the COM Components tab
  • Tick the box beside the name of your COM library
  • Find the OCX control in the toolbox and drag it onto the WinForm designer
  • Now the AxInterop COM library with automagically be added to your project and you can build
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top