[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern bool PathMatchSpec([In] string pszFileParam, [In] string pszSpec);
''' <summary>
''' Searches a string using a Microsoft MS-DOS wildcard match type.
''' </summary>
''' <param name="pszFile">A pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be searched.</param>
''' <param name="pszSpec">A pointer to a null-terminated string of maximum length MAX_PATH that contains the file type for which to search. For example, to test whether pszFile is a .doc file, pszSpec should be set to "*.doc".</param>
''' <returns>Returns TRUE if the string matches, or FALSE otherwise.</returns>
<DllImport("shlwapi.dll", EntryPoint:="PathMatchSpecW", SetLastError:=True, CharSet:=CharSet.Unicode)> _
Public Function PathMatchSpec(<MarshalAs(UnmanagedType.LPTStr)>pszFile As String, _
<MarshalAs(UnmanagedType.LPTStr)>pszSpec As String) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Private Declare Auto Function PathMatchSpec Lib "shlwapi" _
(ByVal pszFileParam As String, _
ByVal pszSpec As String) As Boolean
None.
None.
Please add some!
if(PathMatchSpec("C:\\test.txt", "*.txt"))
{
// This is text file.
}
Private Function MatchSpec(ByVal sFile As String, ByVal sSpec As String) As Boolean
Return PathMatchSpec(sFile, sSpec)
End Function
Private Function MatchSpec(ByVal sFile As String, ByVal sSpec As String) As Boolean
MatchSpec = PathMatchSpec(sFile, sSpec)
End Function
Do you know one? Please contribute it!