Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting a printer with net use
Message
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01025501
Message ID:
01025508
Views:
13
IF WSH is an option
oNet = CreateObject("WScript.Network")
oNet.AddPrinterConnection("LPT1", "\\ADMINISTRACION\laserjet", .F.)
Otherwise, see NETRESOURCE structure class File #9502

>I need to capture (NET USE) a printer depending on a value stored in a table (mydata.dbf)..
>I've tryed this:
>
>
>DECLARE INTEGER ShellExecute IN shell32.dll ;
>INTEGER hndWin, ;
>STRING cAction, ;
>STRING cFileName, ;
>STRING cParams, ;
>STRING cDir, ;
>INTEGER nShowWin
>if mydata.impresora="01"
>     cFileName = "NET USE LPT1: \\ADMINISTRACION\laserjet"
>else
>     cFileName = "NET USE LPT1: \\ADMINISTRACION\epsonlx"
>endif
>cAction = "open"
>ShellExecute(0,cAction,cFileName,"","",1)
>
>
>
>But it doesn't work..
>I'm shure the mistake is when assigning the cFileName parameter, but i don't know how to work with it..
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform