Visual C # How to Use the Active X component Author: Ma Jinhu Source: The author agrees to repost it from the computer world Edit responsibility:
3. UnmanagedCodeConvert the Active X component of to the class library of the managed code:
The. NET Framework provides a conversionProgramThis program can be used to convert a non-managed code to a managed code. The program name is “tlbimp.exe. You can use the following command to complete the conversion:
Tlbimp mydll. dll/out: My. dll
A "My. DLL class library, which defines a namespace as "my" and defines a class "class1" in this namespace ", this class has a method called "show.
4. Use the Active X component compiled into the managed code:
In fact, this is not very accurate, because the Active X component cannot be managed code. At this time, the Active X component has become a class library that can be used by the. NET development language. This is mainly for better understanding. With the above introduction, you can complete the following procedures.
Using my;
Using system;
Public Class ActiveX
{
Public static void main ()
{
Class1 S = new class1 ();
S. Show ();
}
}
Is the running interface of the compiled program:
Figure 5: program running interface
V. Summary:
Actvie X components are a huge family of powerful components with many functions. Taking full advantage of these Active X component resources is not only the use of previous resources, in addition, it can also solve many problems that are difficult or difficult to solve by relying on existing technologies. In fact, the usage of the Active X component in Visual C # is similar to that in Visual Basic. NET and Other. NET development languages.