Chapter 27 Quick Reference


To

Do this

Use a COM object from .NET code.

If you’re using Visual Studio .NET, use the wizard to add a reference to the COM component. If you’re compiling from the command line, use the tlbimp.exe tool to generate an RCW for the COM object, and then reference the wrapper in your code as you would any other .NET class.

Use a COM object via late binding.

Use the static GetTypeFromProgID or GetTypeFromCLSID methods of the Type class to generate a Type object representing the COM object. Then use the CreateInstance static method on the System::Activator class to create an instance of the object. Finally, use InvokeMember on the Type object to invoke your chosen member.

Use an ActiveX control from a Windows Forms project.

If you’re using Visual Studio .NET, add the ActiveX control to the Toolbox, and use it as you would any other Windows Forms control. If you’re compiling from the command line, use the aximp.exe tool to generate an RCW for the ActiveX control, and then reference the wrapper assembly in your Windows Forms project. Then use the wrapper object as you would any other control.




Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
EAN: N/A
Year: 2003
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net