Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Caught in the net
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00526023
Message ID:
00526078
Views:
23
This message has been marked as a message which has helped to the initial question of the thread.
A solution i use is the CopyFile API to Check for the connection in the following example the function copy a dummy file on the remote disk and then delete it, The function returns .T. if successfull.
FUNCTION CheckForDrive

LOCAL lcMyComputer, llOK, lnResult, lcFile, lcDrive

lcDrive = "\\SomeServer\SomeDir\"

Declare Integer CopyFile In Win32Api String, String, Integer
Declare Integer DeleteFile In Win32Api String

lcMyComputer = ALLTRIM(SUBSTR(SYS(0), 1, AT( '#', SYS(0) ) -1))
lcFile = ADDBS(SYS(2023)) + lcMyComputer + ".Tmp"
StrToFile("Test", lcFile) 
lnResult = CopyFile( lcFile, lcDrive + lcMyComputer + ".Tmp" ,0 )
IF lnResult # 0 
	=DeleteFile(lcDrive + lcMyComputer + ".Tmp")
ENDIF

RETURN IIF(lnResult # 0, .T., .F. )
>Is there a non-blocking API function which will allow me to check if a certain network path is accessable. I have been using the foxpro DIRECTORY function and have had a problem with lost network connections. If a connection on a particular mapped drive is lost this function can cause the program to hang waiting for an acceptable response. Any help would be appreciated.
>
>Thanks
>
>Glenn
Previous
Reply
Map
View

Click here to load this message in the networking platform