Using TConnector in VC++ .NET without MFC

 

Attention: You need some of the Microsoft .NET Framework utilities – make sure you have them installed. Usually you can find the Microsoft .NET Framework tools in the following path:

 

C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin

 

Please read the appendix to get more information about the Microsoft .NET Framework tools.

 

Arrangement

 

First you have to convert the TConnector2.dll type library to a .NET-Assembly.

 

Use the following command (in DOS prompt) to do this:

            Tlbimp.exe "c:\Program Files\TEC-IT\TConnector2\TConnector2.dll"

 

è The result is a file named TCONNECTOR2Lib.dll

 

To get more information about content of the assembly you can use a tool named ILDASM.

The command is:

             Ildasm.exe TCONNECTOR2Lib.dll

 

 

In your SOURCE CODE...

 

Include the Assembly

To include the assembly in your VC++.NET project use:

            #using "TCONNECTOR2Lib.dll"

 

Use the namespace of the Assembly:

            using namespace TCONNECTOR2Lib;

 

How to use TConnector in your project

To use TConnector in your project you have to create a TConnector object. You can do this as follows:

 

            TConnector2Class *pTC = new TConnector2Class();

 

Using the TConnector object

Now you can set the properties and call the methods of TConnector:

 

            pTC->Device = S"COM2 ";

            pTC->Open();

            ....

 

Useful .NET Framework Tools

 

Type Library Importer (Tlbimp.exe)
Converts the type definitions found within a COM type library into equivalent definitions in managed metadata format.

 

MSIL Disassembler (Ildasm.exe)
Takes a PE file that contains MSIL code and creates a text file suitable as input to the MSIL Assembler (Ilasm.exe)

(MSIL = Microsoft Intermediate Language)

 

Windows Forms ActiveX Control Importer (Aximp.exe)
Converts type definitions in a COM type library for an ActiveX control into a Windows Forms control.

 

For example:

Aximp.exe TConnector2.dll

                        à TCONNECTOR2Lib.dll            (use as object)

                        à AxTCONNECTOR2Lib.dll        (use on a form or dialog)

 

 

Windows Forms Class Viewer (Wincv.exe)
Finds managed classes matching a specified search pattern, and displays information about those classes using the Reflection API. 

 

InteliSense Information

Sometimes you have to restart Visual Studio to use the IntelliSense Information.

 

IntelliSense: When you write for example „pTC->” Visual Studio show you a list of all methods and properties.