Home Page About Us
Links to other internet sites Contact Us

Frequently Asked Questions about "ParaPort.Dll"

How to access the ParaPort.dll from a MFC application?

To use ParaPort in a MFC Application ( the ParaPortUtility application is one ), you should

  • call the "loadLibrary( )" method in the "InitInstance( )" method of the application's main class derived from "CWinApp"
  • call the "deleteSingleton( )" method in the "ExitInstance( )" method of the same class
  • instanciate a class member "HANDLE m_Handle;" of an appropriated class ( e.g.: a class derived from "CDocument" or "CDialog". This class must first call the methods "openPort( )" and than can access to the parallel port ( "executeCycle( )" ). Do not forget to call "closePort( )" in it's destructor.

A simple MFC sample will be added in release v2.0.

How to access the ParaPort.dll from a Visual Basic application?

The release v1.3 cannot be used by Visual Basic programs. In release v2.0, the DLL interface will be changed to support Visual Basic.

Why do you not supply a "*.lib" file for linking directly your DLL?

The library of ParaPort has the form of a "*.dll" file because of the following advantages:

  • Distributing the ParaPort library as static linked library "ParaPort.lib" generates problems with different compiler options between library file and client application ( e.g.: library in single thread, application in multi thread model ).
  • Using a "*.dll" file by linking the corresponding "*.lib" file let Windows search and load the "*.dll" file at process start. In case of error, a standard message box is displayed and the programmer has no possibility to customize the error handling.
  • A "*.lib file" cannot be used by other development environments ( e.g.: Borland C, Builder, Visual Basic ).

The singleton implementation of class "ParaPortDll" is not the one published.

My implementation of the Singleton is an extension of the singleton published by the four wise men. The Problem of their class is that there is no delete of the allocated memory ( even at end of the process ). Some development utilities verifying, that all allocated memory is also freed, will signal memory leaks at the end of the process.

How to read data from parallel port with "ParaPortDll"?

To read data or status register from the parallel port, the corresponding mask members of the "PARAPORT_CYCLE" structure must be set: The following source code reads the bit 2, 3 and 4 of data register ( to read the howl byte, put 0xFF into variable "MaskData" ) and the "PaperEnd" bit of the status register.

ParaPortCycle Cycle[ 1 ];

UCHAR MaskData = PARAPORT_MASK_DATA_D2

                                        | PARAPORT_MASK_DATA_D3

               | PARAPORT_MASK_DATA_D4;

Cycle[ 0 ].setMaskStatus( PARAPORT_MASK_STATUS_PAPEREND );

Cycle[ 0 ].setDataInput( );

Cycle[ 0 ].setMaskData( MaskData );

Dll->executeCycle( Handle, Cycle, 1 );

UCHAR Data = Cycle[ 0 ].getData( );

bool PaperEnd = Cycle[ 0 ].isStatusPaperEnd( );

A sample "read cycle" will be added in release v2.0 to show this.

When executing sample applications, "ParaPort.dll" cannot be found!

Please have a look to the source code of the samples. The path of the library file is constant to simplify the source code and may be adapted to the customers target directory structure. In a "good" application, the file name should be variable ( e.g.: configuration file, comand line parameter ).

How to access the ParaPort.dll from a .NET / C# application?

There is no extra support ( e.g.: classes ) of the .NET framework previewed. Remember how much Microsoft promoted "ActiveX", everybody implemented and now, nobody is talking about it anymore. I will wait that this framework gets stable and see. There should be some technics integrated into C# to access a simple C dynamic link library as ParaPort.dll is.

Copyright (c) 2002, 2003, 2004 by , v2.0, read the Terms of Use

 

Documentation about ParaPort
Source code of ParaPort
Licenses for ParaPort
Download Software
Customer Feedback

Last Site Update: 07.01.2004

Current Site Release: v2.0 b2

Current Software Release: v2.0 beta b3