SearchPath (kernel32)
Last changed: -213.91.216.112

.
Summary
Searches for the specified file in the specified path.

C# Signature:

[DllImport ( "kernel32.dll" ,

          SetLastError = true ,
          CharSet = CharSet.Auto )]

static extern uint SearchPath ( string lpPath ,

                string lpFileName ,
                string lpExtension ,
                int nBufferLength ,
                [MarshalAs ( UnmanagedType.LPTStr )]
                StringBuilder lpBuffer ,
                out IntPtr lpFilePart );!!!!User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

[DllImport ( "kernel32.dll" ,

          SetLastError = true ,
          CharSet = CharSet.Auto )]

public static extern uint SearchPath ( string lpPath ,

                       string lpFileName ,
                       string lpExtension ,
                       int nBufferLength ,
                       [MarshalAs ( UnmanagedType.LPTStr )]
                       StringBuilder lpBuffer ,
                       out IntPtr lpFilePart );

static void Main ( string [] args )

{

    StringBuilder sb = new StringBuilder ( 260 );
    IntPtr ptr = new IntPtr ( );

    SearchPath ( null ,
        "NOTEPAD.EXE" ,
         null ,
         sb.Capacity ,
         sb ,
         out ptr );

   Console.WriteLine ( sb.ToString ( ) );

}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
SearchPath on MSDN