Click here to Skip to main content
15,881,139 members
Articles / Programming Languages / C#

C# does Shell, Part 4

Rate me:
Please Sign up or sign in to vote.
4.93/5 (84 votes)
26 Mar 2003Ms-PL14 min read 288.8K   4.7K   165  
This article is about the AutoComplete features enabled by windows and how to use them with C#. AutoComplete is the ability to expand strings written in an edit box. The article will develop a class for using this functionality in you applications.
using System;
using System.Runtime.InteropServices;

namespace ShellLib
{
	[ComImport]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("9CC22886-DC8E-11d2-B1D0-00C04F8EEB3E")]
	public interface IFolderFilter
	{
		// Allows a client to specify which individual items should be enumerated.
		// Note: The host calls this method for each item in the folder. Return S_OK, to have the item enumerated. 
		// Return S_FALSE to prevent the item from being enumerated.
		[PreserveSig] 
		Int32 ShouldShow(
			[MarshalAs(UnmanagedType.Interface)]Object psf,				// A pointer to the folder's IShellFolder interface.
			IntPtr pidlFolder,		// The folder's PIDL.
			IntPtr pidlItem);		// The item's PIDL.

		// Allows a client to specify which classes of objects in a Shell folder should be enumerated.
		[PreserveSig] 
		Int32 GetEnumFlags( 
			[MarshalAs(UnmanagedType.Interface)]Object psf,				// A pointer to the folder's IShellFolder interface.
			IntPtr pidlFolder,		// The folder's PIDL.
			IntPtr phwnd,			// A pointer to the host's window handle.
			out UInt32 pgrfFlags);	// One or more SHCONTF values that specify which classes of objects to enumerate.
		
	};

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).

Comments and Discussions