Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting a Network in Win NT4.0
Message
 
To
06/11/1997 09:16:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00058197
Message ID:
00058586
Views:
27
>>>I have a FoxProw 2.6 application I am converting to VFP 5.0.
>>>FoxProw 2.6 application runs under Win 3.11 or Win 95 on Novell.
>>>
>>>The FoxProw 2.6 application allows people to "check out" files to
>>>work on on their laptops.
>>>
>>>Rather than have two different applications, one for running on the
>>>'network' and one to run on 'local' (laptop) computers I have the
>>>application determine if there is a network attached to the computer.
>>>
>>>In the FoxProw 2.6 application the following has always worked:
>>>
>>>glNetwork = adir("aadir","f:\*.*","D") > 0
>>>
>>>etc...
>
>>
>>Don,
>>
>>You could probably do something like this:
>>
>>FUNCTION Is_Net
>>
>>DECLARE INTEGER GetLogicalDrives IN Win32API
>>DECLARE INTEGER GetDriveType IN Win32API;
>> STRING lcdrive
>>LOCAL lndrivemap, llresult, lni, lcdrive, lndrivetype
>>lndrivemap = GetLogicalDrives()
>>llresult = .F.
>>* Start with D:
>>lni = 2
>>DO WHILE lni < 31 AND NOT llresult
>> lni = lni + 1
>> IF BITTEST(lndrivemap, lni)
>> lcdrive = CHR(65 + lni) + ":\:
>> lndrivetype = GetDriveType(lcdrive)
>> llresult = (lndrivetype = 4)
>> ENDIF
>>ENDDO
>>RETURN llresult
>

Don,

You're welcome. Just one note, however. In my haste in writing the above function, there is an error (kinda) that you might want to correct. You can reduce the maximum value of the loop counter to 26. As far as I know, there ain't no more drives after "Z" and I'm pretty sure that drive "[" isn't acceptable. ;-)

George


>George,
>
>Thank you. It worked quite well.
>
>Don
>>
>>That will tell you whether or not a net is present without generating any error messages. Side note, FOXTOOLS has a function called DriveType that's a hook into GetDriveType. You pass it the same parameters and it returns the same values.
>>
>>hth,
>>
>>George
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform