The following code:
If FileExists(XCustPath + "XCust.dat") Then
XCustRun
End If
and this code:
Public Function FileExists(ByVal Fname As String) As Boolean
Dim lRetVal As Long
Dim OfSt As OFSTRUCT
lRetVal = OpenFile(Fname, OfSt, OF_EXIST)
If lRetVal <> HFILE_ERROR Then
FileExists = True
Else
FileExists = False
End If
End Function
XCustPath points to a mapped network location with the file XCust.dat inside it.
But on the line:
lRetVal = OpenFile(Fname, OfSt, OF_EXIST)
It takes forever and locks up my program for 20-30 seconds. It needs to check if this file exists on the network in less than 1 second as it is for a legacy point of sale application. Is there anyway I can force it to timeout the line of code if it takes longer than a second? If it does exist it runs smoothly and perfect. Or a VERY quick way of checking if a file on the network exists?