in foxpro is possible to be made many things, and thanks to it, we can remove to him to benefit to component external, such as com objects, or own windows components, as it is the case of the windows scripting host.  it is possible that with function aprinters, we obtain but data that the one that has been obtained in this routine, but this it was a small example that if we removed benefit of everything we will be but productive.

here the example:

*/ showprinterswithwsh.prg
*/ this is a routine that shows the ;
   printers installed in the computer,;
 only using the windows scripting host, ;
   without the necessity to use the native ;
   function aprinters of visual foxpro.
*/ author: ronald ramirez
*/ creation date: june, 2003
local wshnetwork as "" &&wshnetwork
local printers as object &&wshcollection
local i as integer

wshnetwork = createobject("")
printers = wshnetwork.enumprinterconnections

for i = 1 to printers.count - 1 step 2
    ? "printer name: "
    ?? printers.item(i)
    ? "port: "
    ?? printers.item(i - 1)

? "total of installed printers: "
?? int(printers.count / 2)

printers = .null.
wshnetwork = .null.



Leave a Reply

Your email address will not be published. Required fields are marked *