Click here to Skip to main content
15,895,142 members
Articles / Programming Languages / C#

Dual Pane File Manager

Rate me:
Please Sign up or sign in to vote.
4.64/5 (28 votes)
21 Dec 2010CPOL8 min read 140.8K   2.3K   119  
A dual pane file manager for Windows XP.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace JGLibrary
{
	class JInterfaces
	{
	}


	[ComImport, Guid("00000000-0000-0000-c000-000000000046")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IUnknown
	{
		[PreserveSig()]
		IntPtr QueryInterface(ref Guid riid, ref IntPtr pVoid);

		[PreserveSig()]
		ulong AddRef();

		[PreserveSig()]
		ulong Release();
	}

	[ComImport]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[GuidAttribute("000214e4-0000-0000-c000-000000000046")]
	public interface IContextMenu : IUnknown
	{
		[PreserveSig()]
		int QueryContextMenu(IntPtr hMenu, uint indexMenu, uint idCmdFirst, uint idCmdLast, uint uFlags);

		[PreserveSig()]
		void InvokeCommand(ref CMINVOKECOMMANDINFO pici);

		[PreserveSig()]
		void GetCommandString(UIntPtr idcmd, uint uflags, uint reserved, StringBuilder commandstring, uint cch);
	}

	[ComImport]
	[Guid("000214f4-0000-0000-c000-000000000046")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IContextMenu2 : IContextMenu
	{
		[PreserveSig()]
		new int QueryContextMenu(IntPtr hMenu, uint indexMenu, uint idCmdFirst, uint idCmdLast, uint uFlags);

		[PreserveSig()]
		new void InvokeCommand(ref CMINVOKECOMMANDINFO pici);

		[PreserveSig()]
		new void GetCommandString(UIntPtr idcmd, uint uflags, uint reserved, StringBuilder commandstring, uint cch);

		[PreserveSig()]
		int HandleMenuMsg(uint uMsg, IntPtr wParam, IntPtr lParam);
	}

	[ComImport]
	[Guid("bcfce0a0-ec17-11d0-8d10-00a0c90f2719")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IContextMenu3 : IContextMenu2
	{
		[PreserveSig()]
		new int QueryContextMenu(IntPtr hMenu, uint indexMenu, uint idCmdFirst, uint idCmdLast, uint uFlags);

		[PreserveSig()]
		new void InvokeCommand(ref CMINVOKECOMMANDINFO pici);

		[PreserveSig()]
		new void GetCommandString(UIntPtr idcmd, uint uflags, uint reserved, StringBuilder commandstring, uint cch);

		[PreserveSig()]
		new int HandleMenuMsg(uint uMsg, IntPtr wParam, IntPtr lParam);

		[PreserveSig()]
		int HandleMenuMsg2(uint uMsg, IntPtr wParam, IntPtr lParam, ref IntPtr plResult);
	}

	[ComImport, Guid("000214f2-0000-0000-c000-000000000046")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IEnumIDList : IUnknown
	{
		[PreserveSig()]
		int Next(uint count, ref IntPtr idList, ref uint fetched);

		[PreserveSig()]
		int Skip(uint count);

		[PreserveSig()]
		int Reset();

		[PreserveSig()]
		int Clone(ref IEnumIDList list);
	}

	[ComImport, Guid("000214E6-0000-0000-c000-000000000046")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IShellFolder : IUnknown
	{
		[PreserveSig()]
		int ParseDisplayName(IntPtr hWnd, IntPtr pbc, [MarshalAs(UnmanagedType.LPWStr)] string pwszDisplayName, ref uint pchEaten, ref IntPtr ppidl, ref uint pdwAttributes);

		[PreserveSig()]
		int EnumObjects(IntPtr hWnd, SHCONTF flags, ref IEnumIDList enumList);

		[PreserveSig()]
		int BindToObject(IntPtr idList, IntPtr bindingContext, ref Guid riid, ref IShellFolder folder);

		[PreserveSig()]
		int BindToStorage(IntPtr idList, IntPtr bindingContext, Guid riid, IntPtr pVoid);

		[PreserveSig()]
		int CompareIDs(uint lparam, IntPtr idList1, IntPtr idList2);

		[PreserveSig()]
		int CreateViewObject(IntPtr hWnd, ref Guid riid, ref IntPtr pVoid);

		[PreserveSig()]
		int GetAttributesOf(uint count, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] apidl, ref uint attributes);

		[PreserveSig()]
		int GetUIObjectOf(IntPtr hwndOwner, uint cidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] apidl, ref Guid riid, ref uint rgfReserved, [MarshalAs(UnmanagedType.Interface)]ref object ppv);

		[PreserveSig()]
		int GetDisplayNameOf(IntPtr idList, uint flags, ref STRRET strRet);

		[PreserveSig()]
		int SetNameOf(IntPtr hWnd, IntPtr idList, [MarshalAs(UnmanagedType.LPWStr)] String pszName, uint flags, ref IntPtr pItemIDList);
	}

	[ComImportAttribute()]
	[GuidAttribute("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1")]
	[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IExtractImage : IUnknown
	{
		void GetLocation(StringBuilder pszPathBuffer, int cch, ref int pdwPriority, ref SIZE prgSize, int dwRecClrDepth, ref int pdwFlags);
		void Extract(ref IntPtr phBmpThumbnail);
	}

}

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 Code Project Open License (CPOL)


Written By
Retired
United Kingdom United Kingdom
I have been a keen hobbyist programmer since getting my first computer - a Vic 20 (you had to be able to write programs then since few programs were available and all were expensive).
Retired and now living in Pewsey, Wiltshire, where I spend (far too much of) my time writing computer programs to keep my mind active.

Comments and Discussions