dberndt
Feb 18th, 2001, 01:45 AM
Hi
i have recently been righting a highly modified/specialized installer and i need to search the whole path and the windows directories for a file to find out if it exists. So i figure what better way than searchpath.
Declare Function SearchPath Lib "kernel32" Alias "SearchPathA" (ByVal lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
The problem is that either i am not passing it a proper null string for the lpPath or it doesn't work as the msdn says. I can do this
x= SearchPath("","autoexec.bat", "", 0, temp, 0)
and x is always 0
but if i just give it
x= SearchPath("c:\","autoexec.bat", "", 0, temp, 0) it works great. so i suspect that there is something funky happenning when i pass it "" for lpPath.
Any help would be appreciated.
Thanks
David Berndt
i have recently been righting a highly modified/specialized installer and i need to search the whole path and the windows directories for a file to find out if it exists. So i figure what better way than searchpath.
Declare Function SearchPath Lib "kernel32" Alias "SearchPathA" (ByVal lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
The problem is that either i am not passing it a proper null string for the lpPath or it doesn't work as the msdn says. I can do this
x= SearchPath("","autoexec.bat", "", 0, temp, 0)
and x is always 0
but if i just give it
x= SearchPath("c:\","autoexec.bat", "", 0, temp, 0) it works great. so i suspect that there is something funky happenning when i pass it "" for lpPath.
Any help would be appreciated.
Thanks
David Berndt