Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capturing a LPT port in NT
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00150018
Message ID:
00150140
Views:
25
>I am attempting to use the following code to attach a local LPT port to a Windows printer. I must map it to an LPT port for an application that uses LPT ports to print to.
>
>clear
>declare integer WNetAddConnection in "mpr.dll" string @, string @, string @
>
>cServerName = "\\NORDAM_NDS\Q_MIS_PROG_4K"
>cLocalname = "LPT2:"
>cPassword = "0"
>
>nResult = WNetAddConnection(@cServername,@cPassWord,@cLocalName)
>? nResult
>
>IF APRINTERS(gaPrinters) > 0 && If there are installed printers
> DISPLAY MEMORY LIKE gaPrinters && Display printers and ports
>ELSE && Otherwise, no printers are installed
> WAIT WINDOW 'No printers installed.'
>ENDIF
>
>
>I am getting an Error code 5... access denied. But, if I go into Control Panel, Printers... I can map this printer to an LPT port using the Properties of the printer. ??? Help! ???
>
>-Tim

Hi Tim,

I think the problem may be the password parameter. Rather than "0" try sending 0. The number rather than the string will evaluate as a null string.

hth
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform