Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Network Neighborhood
Message
From
26/01/2000 05:38:30
 
 
To
26/01/2000 04:39:17
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00322072
Message ID:
00322689
Views:
21
>Hi Ed,
>
>I have downloaded your files, and it worked fine the first time. But now it kills VFP each time I run it.
>
>It returns informations of the network printers 18 times before it kills VFP. The printers are connected to the network by an IP adress.
>
>How can I change the program so it does'nt look for printers ???
>

Read the code, and you'll find all the detail there - the cType value should be set to 'DISK' if you want just disk resources - just call the public SetType method with a value of 'DISK'; the default if not set is 'ANY' (disk and printer resources), and the alternatives are DISK or PRINTER.

If you're just modifying GetAllShare to do your hunting for you, just change the WNetOpenEnum so that dwType is 1 (disk). Changing all occurances of the line:

=WNetOpenEnum(2,0,3,0,@hEnum)

to

=WNetOpenEnum(2,1,3,0,@hEnum)

limits you to disk resources (the second parameter is the dwType argument.) The API call is at declared at the top of the code for GetAllShare. The code is pretty heavily commented. RTFC!

I just went and ran GetAllShare about a dozen times under VFP6 from the command window, and no duplication occurs. Realize that it's digging down layers; if you have a machine with 20 distinct shares, it'll appear at least 21 times - the container under the provider, plus each share instance. If all you wanted were the machines, you'd dig down to the first container sibling layer under each provider. I have a network here with 3 machines as a part of a domain called EDHOME; GetAllShare digs down as follows
  Microsoft Network
    EDHOME (my domain - CONTAINER)
     \\ED3  (a Win2K workstation)
      \\ED3\DVD      - share of the DVD drive
      \\ED3\EPSON600 - and my old Epson Stylus
      \\ED3\C 
     \\NTSERVER4      - the NT 4.0 Server box
      \\NTSERVER4\NETLOGON
      \\NTSERVER4\E
      \\NTSERVER4\A
      \\NTSERVER4\c_drive
      \\NTSERVER4\Encarta99
      \\NTSERVER4\d_drive
      \\NTSERVER4\drive_f
      \\NTSERVER4\MSDNDIST
     \\EDRAUH        - a Win98SE box
      \\EDRAUH\E_98
      \\EDRAUH\C
      \\EDRAUH\MSDOWNLOAD.TMP
      \\EDRAUH\HPLJ 
      \\EDRAUH\CDRBURN
      \\EDRAUH\JAZ
22 distinct containers or connectable resources on 3 machines, no laptop hooked up, and the WinNT 4 workstation in pieces at the moment. It takes about 5 or 6 seconds to hunt down all the pieces, and this is a small 100mbps net...

You'd just be intersted in the three top-level containers beneath the provider, with no need to recursively search. If you don't want the behavior in the demo code, change it to do what you want (or if you're too lazy and willing to pay, I'll be happy to give you a quote on what it'll cost.)

IOW, stop being so damned lazy and read the code to see what the stuff does.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform