>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
ELSE
?? ' = ' + ItemValue
ENDIF
lIsMapping = ! lIsMapping
ENDFOR
You could use similar techniques to populate a two-dimensional array of drives and mappings