Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Paralell port
Message
De
27/05/1999 07:45:33
 
 
À
27/05/1999 07:02:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00222851
Message ID:
00223358
Vues:
26
>Ok Barbara,
>
> We're developing a board that controls a Xerox machine, enable or
>disable and count the number of copies that especific user made.
> And this board is conected in the paralell port.
> I know that is possible to do this with a COM port using fopen(),
>fread(), fwrite() etc... But I never did something like this.

Actually, you can't. You'd need to use the MSCOMM32 control or the equivalent under VFP5/6 to read/write serial ports. There is sample code here on UT demonstrating how to use the MSCOMM32 ActiveX control, and there's extensive documentation in the MSDN on it, albeit in VB, but it's fairly easy to make the transition. You'll probably want to get VFPCOM from Microsoft's web site msdn.microsoft.com/vfoxpro/downloads/vfpcom.exe since that will allow you to bind the ActiveX control's events to VFP, allowing you to use VFP to respond to OnComm events without having to continuously poll the serial port.

> So, I want some example using this functions above with COM port,
>AND another exmples using paralell port.

I'm not certain if MSCOMM32 will work with a parallel port (I haven't tried) but on one project that I worked on some time ago for a client, we had to write the parallel port interface code in C++ (C would work as well, but we chose to create an MFC-based in-process OLE Server to handle the interface for us.) There are numerous control signal problems with parallel ports that don't exist for serial ports, and there are differences in the behavior of various flavors of parallel port (unidirection, AT-compatible bidirectional, EPP in a couple of flavors and ECP behave differently and use various signal lines on the port differently.) You'll probably need to make extensive use of the DeviceIoControl API call. Depending on how the Xerox machine talks through the parallel port, the standard Win32 VCOMM parallel port driver may not give you adequate functionality to do what you need done.

The MSDN contains detailed information on the Win32 Parallel and Serial Devices and Driver Layer, and the Win32 DDK documentation, and Walter Oney's Systems Programming for Windows 95 cover many of the issues in detail, and include sample C code for creating/using VCOMM interface drivers.

I'd check with Xerox to see if they have either an ActiveX control or C call interface compatible .DLL available to handle things for you, otherwise, you're likely to find it far easier to use a language with a less cumbersome interface to low-level API calls like C/C++, Pascal/Delphi, or even VB, to handle the parallel port for you, and then create either an OLE Server or .DLL for VFP to talk to in the other language.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform