[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern bool PathMatchSpec([In] String pszFileParam, [In] String pszSpec);
Private Declare Auto Function PathMatchSpec Lib "shlwapi" _
(ByVal pszFileParam As IntPtr, _
ByVal pszSpec As IntPtr) As IntPtr
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
Dim FilePtr As IntPtr = Marshal.StringToHGlobalAuto(sFile)
Dim SpecPtr As IntPtr = Marshal.StringToHGlobalAuto(sSpec)
Dim Match As Boolean
Match = PathMatchSpec(FilePtr, SpecPtr)
Marshal.FreeHGlobal(FilePtr)
Marshal.FreeHGlobal(SpecPtr)
Return Match
End Function
Do you know one? Please contribute it!