>Thanks for your reply. (I remember that you had helped me before with using VFP's registry class.) How do I use the Window Script Host's Network object to set the default printer? Is it easier/better to use than your INIfiles class?
>
>
Maria,
Let me answer the last question first. There's significantly less overhead in terms of code. In order to do this with the API, at least two APIs call are required (which, of course, have to be declared as well). There's more processing overhead with the WSH. Further, the WIN.INI is purely for backward compatibility. Settings such as this under Win32 are kept in the registry. Of course, in order to be able to use the WSH, it must be installed. You'll find all the questions you might have in this regard covered in the September issue of the VFUG newsletter which is available on-line at
www.vfug.org.
In order to change the default printer using the WSH
lcprinter = SET('PRINTER', 2)
lcnewprn = "LPT1:"
lnlast = APRINTERS(a_prns)
llfound = .F.
lni = 0
DO WHILE lni < lnlast AND NOT llfound
lni = lni + 1
llfound = (lcprinter = UPPER(a_prns[lni, 1]))
ENDDO
lcoldprn = a_prns[lni, 2]
oNet = CREATEOBJECT('WScript.Network')
oNet.SetDefaultPrinter(lcnewprn)
oNet.SetDefaultPrinter(lcoldprn)
Note that most of the stuff above you'd have to do anyway when using the API.
George
Ubi caritas et amor, deus ibi est