Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH Odd Behaviour in Debugger
Message
From
07/12/2001 15:44:26
 
 
To
07/12/2001 13:58:48
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00591305
Message ID:
00591436
Views:
27
This message has been marked as the solution to the initial question of the thread.
>George,
>
>>Gee...that looks familiar.< g >
>
>I'm trying! Felt very badly about the earlier thread and thought I would really get into it instead of just spouting off what I don't know. :-) Great articles by the way. I'm trying to get my hands on the book, but everyone is telling me it will take over a week to get.
>
>>Are you saying that the code runs fine without the debugger? Originally, it (or something similar) was written on Win98SE connected to a Novell network in VFP 6.0. It worked fine (no debugger). I just copied and pasted it into a prg in VFP 7.0. Works fine. Same thing in 6.0 and in stepping through in the debugger.
>
>No, it crashes and then I open the debugger to check it out. Something odd is that in the debugger if I type "oNetDrives" in the Watch window and expand the node it shows a value of 20 for the Count, but "expression could not be evaluated" for Item. Yet in the Trace window using a "hover" the value shows "F:" which is a valid drive designation. Does that mean anything? Do I have a larger environmental problem going on? I'm using VFP6 sp3 on an NT4 workstation.

No, it's an ongoing problem with the first reference to the property of a COM object that hasn't been pre-registered through a wrapper; the properties of a COM object are only made visible after they've been examined once, at least in some versions. The following might help - rather than indexing explicitly, try a FOR...EACH construct, like:
lIsMapping = .t.
oNet = CREATEOBJECT("WScript.Network")
oNetDrives = oNet.EnumNetworkDrives
FOR Each ItemValue IN oNetDrives
   IF lIsMapping
      ? ItemValue && Displays the drive mapping
   ELSE
      ?? ' = ' + ItemValue && Displays the share
   ENDIF
   lIsMapping = ! lIsMapping
ENDFOR
You could use similar techniques to populate a two-dimensional array of drives and mappings
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