all groups > dotnet interop > february 2006 >
You're in the

dotnet interop

group:

Visual Studio ActiveX import


Visual Studio ActiveX import Charley
2/28/2006 8:48:42 PM
dotnet interop:
Hello,

I'm trying to use an ActiveX object from a c# project in Visual Studio 2005.
I don't understand the difference between adding the .ocx file as a
reference and adding the .ocx file to the toolbox then dropping it on a
form. I can only get functionality working if I add it through the toolbox
and drop it on a form. I notice in my project references that this method
prefixes the object with an 'Ax' while the 'add as a reference' method does
not. This particular ActiveX object has NO visual features and is used for
socket communication with a financial server. I would much rather just add
is as a reference, create an instance manually and hook in my events, but I
can't seem to get it working this way.

I assume both of these methods are automatically in VS2 2005 doing something
similar to the COM Interop Utility (TlbImp.exe). Is this true?

What is the difference?



RE: Visual Studio ActiveX import v-phuang NO[at]SPAM online.microsoft.com (
3/1/2006 12:00:00 AM
Hi

The difference is that when we add it via ToolBox, there will generate two
dll.
e.g. the webbrowser
1. Interop.SHDocVw
2. AxInterop.SHDocVw

We also can use the tool aximp to do that.

But if we do that via adding reference, there will only generate the dll
1. Interop.SHDocVw

We can also use the tool tlbimp to do that.

Commonly you are right, if we did not want the UI feature we can just use
the Add reference to generate the (Interop.SHDocVw).
For the WebBrowser ActiveX control, this is true.

But for your scenario, I think the ActiveX control need the wrap in the
AxInterop.<YourControl>.dll, so it did not work with only the
Interop.<YourControl>.dll.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button