Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Writing data to lpt port using CreateFile(), is it possi
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00092263
Message ID:
00092992
Views:
23
>>I want to write data to lpt1 port to control PCU customer display.
>>The only way to do using vfp native commands is "run copy fn lpt1"
>>but this is too low for disply control.
>>
>>So the only possibility is to use API.
>>
>>I tried the following command:
>>
>>declare short CreateFile in win32api
>> ...
>>secattr = chr(12) + repl( chr(0), 11 )
>>lcPORT = 'COM1'+chr(0)
>>I= createfile( @lcport, 0 , 0, @secattr, 3,0, 0 )
>>J=GETLASTERRor()
>>
>>But createfile return -1 and getlasterror() returns
>>87 ERROR_INVALID_PARAMETER!
>>
>I'm a bit confused. You mention LPT1 (Parrelel Port), but the code in your example shows COM1 (Serial Port). I would guess that the low level file functions (FOPEN(), etc.) map directly to the Win API functions for these tasks. Because of this, I don't think that you can open the printer ports using CreateFile(), if FOPEN() fails.
>
>Further, most of the information on this subject that I've read separates communications (modems, etc.) from printing. So my guess is that you can't do this with CreateFile().

I'm sorry. The line above shoult be

lcPORT = 'lpt1'+chr(0)

George, which API calls must be used to send data directly to lpt port?
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform