Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A tool to order the window buttons in your taskbar

, 9 Aug 2005
Move your window buttons into your preferred order. WinXP or later only.
taskbarsorter_app_1.zip
taskbarsorter_app_2.zip
taskbarsorter_src_1.zip
TaskbarSorter.1
System.Runtime.InteropServices.APIs.dll
System.Windows.Forms.TreeListView.dll
TaskbarSorter
Common
Icons
MoveDown.ico
MoveFirst.ico
MoveLast.ico
MoveUp.ico
Refresh.ico
WindowsExplorer.ico
Work.ico
TaskbarSorter.snk
TaskbarSorter.debug.FxCop
taskbarsorter_src_2.zip
TaskbarSorter.2
System.Runtime.InteropServices.APIs.dll
System.Windows.Forms.TreeListView.dll
TaskbarSorter
bin
Release
Common
Icons
App.ico
MoveDown.ico
MoveFirst.ico
MoveLast.ico
MoveUp.ico
WindowsExplorer.ico
Work.ico
TaskbarSorter.csproj.user
TaskbarSorter.snk
TaskbarSorter.debug.FxCop
using System;
using System.Diagnostics;

using Common;

namespace TaskbarSorter
{

//-----------------------------------------------------------------------------
// DataType

	public enum DataType
	{
		Process,
		Window,
	}

//-----------------------------------------------------------------------------
// DataBase

	internal abstract class DataBase
	{
		private TBBUTTON _TBButton;
		private string _ButtonText = String.Empty;
		private IntPtr _WindowHandle = IntPtr.Zero;
		private int _ImageIndex = -1;
		private INode _Node = null;

		public TBBUTTON TBButton { get { return _TBButton; } set { _TBButton = value; } }
		public string ButtonText { get { return _ButtonText; } set { _ButtonText = value; } }
		public IntPtr WindowHandle { get { return _WindowHandle; } set { _WindowHandle = value; } }
		public int ImageIndex { get { return _ImageIndex; } set { _ImageIndex = value; } }
		public INode Node { get { return _Node; } set { _Node = value; } }

		public DataBase( TBBUTTON tbButton, string buttonText, IntPtr windowHandle, int imageIndex )
		{
			_TBButton = tbButton;
			_ButtonText = buttonText;
			_WindowHandle = windowHandle;
			_ImageIndex = imageIndex;
		}

		public override string ToString()
		{
			return _ButtonText;
		}


		public abstract DataType DataType { get; }
	}

//-----------------------------------------------------------------------------
// DataProcess

	internal class DataProcess : DataBase
	{
		public DataProcess( TBBUTTON tbButton, string buttonText, IntPtr windowHandle )
			: base( tbButton, buttonText, windowHandle, 0 )
		{
			Debug.Assert( windowHandle == IntPtr.Zero );
		}

		public override DataType DataType { get { return DataType.Process; } }
	}

//-----------------------------------------------------------------------------
// DataWindow

	internal class DataWindow : DataBase
	{
		private UInt32 _ProcessId = 0;

		public UInt32 ProcessId { get { return _ProcessId; } set { _ProcessId = value; } }
		
		public DataWindow( TBBUTTON tbButton, string buttonText, IntPtr windowHandle )
			: base( tbButton, buttonText, windowHandle, 1 )
		{
			UInt32 threadId = User32.GetWindowThreadProcessId( windowHandle, out _ProcessId );

//			Process p = Process.GetProcessById( ( int ) processId );
//			string s2 = p.ProcessName;
//			int z = 0;
		}

		public override DataType DataType { get { return DataType.Window; } }
	}

//-----------------------------------------------------------------------------

}

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)

About the Author

Nicholas Butler

United Kingdom United Kingdom

I built my first computer, a Sinclair ZX80, on my 11th birthday in 1980.
In 1992, I completed my Computer Science degree and built my first PC.
I discovered C# and .NET 1.0 Beta 1 in late 2000 and loved them immediately.
I have been writing concurrent software professionally, using multi-processor machines, since 1995.
 
In real life, I have spent 3 years travelling abroad,
I have held a UK Private Pilots Licence for 20 years,
and I am a PADI Divemaster.
 
I now live near idyllic Bournemouth in England.
 
If you would like help with multithreading, please contact me via my website:
 
 
I can work 'virtually' anywhere!

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 10 Aug 2005
Article Copyright 2005 by Nicholas Butler
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid