Sometimes there are events in life then a invalid filename or foldername has sneaked in due to human misspelling or a crash and causing you headache because you just doesn't find the tiny little error.
I'm notorius in about the shell so this effortless example is no excption and very handy :D
Yes, I know PathFileExistsW exists but mine is funnier (I do think that one uses same princip) :p
Yes, you need Fafalone's TypeLib or Similar.
I'm notorius in about the shell so this effortless example is no excption and very handy :D
Code:
Public Declare Function SHCreateStreamOnFileEx Lib "shlwapi" (ByVal pszFile As Long, ByVal grfMode As STGM, ByVal dwAttributes As FILE_ATTRIBUTES, ByVal fCreate As Long, ByVal pstmTemplate As Long, ppSTM As IStream) As Long
Dim hr As Long: hr = SHCreateStreamOnFileEx(StrPtr(CStr(sFileOrPath)), STGM_READ, 0, 0, 0, Nothing): If hr = &H80070002 Then MsgBox "File does not exist! Must quit!", vbCritical: Exit Function
Yes, you need Fafalone's TypeLib or Similar.