|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
please help guys,
I am wondering what is the VB code to check if a file/application (such as ICQ) is installed in hard drive. and lets say if the application is in installing process(such as ICQ is during instalation) then is it possible to set a timer to check for certanin time? ![]() |
|
#2
|
||||
|
||||
|
search the forum for FileSystemObject
It contains a method for checking if a file exists. |
|
#3
|
|||
|
|||
|
one of many ways...
'Function: FileExists
Public Function FileExists(ByVal FileName$) As Boolean Dim X% On Error Resume Next X% = Len(Dir$(FileName$, vbHidden + vbReadOnly)) If Err Or X% = 0 Then FileExists = False Else FileExists = True End Function |
|
#4
|
||||
|
||||
|
would that code work fr any file type, with any properties, provided you told it to look in the right place?
|
|
#5
|
|||
|
|||
|
it's never let me down, but there are many other ways to do it.
this one also checks for folders and removes the "\" from the end of the path if it exists. '----------------------------------------------------------- ' FUNCTION: FileExists ' Determines whether the specified file exists ' ' IN: [strPathName] - file to check for ' ' Returns: True if file exists, False otherwise '----------------------------------------------------------- ' Public Function FileExists(ByVal strPathName As String) As Integer Dim intFileNum As Integer On Error Resume Next ' 'Remove any trailing directory separator character ' If Right$(strPathName, 1) = "\" Then strPathName = Left$(strPathName, Len(strPathName) - 1) End If ' 'Attempt to open the file, return value of this function is False 'if an error occurs on open, True otherwise ' intFileNum = FreeFile Open strPathName For Input As intFileNum FileExists = IIf(Err, False, True) Close intFileNum Err = 0 End Function |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > how to check if a file exist?? please help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|