Click here to Skip to main content
15,886,873 members
Articles / Programming Languages / C#

Middle Mouse Button (or Wheel) to Doubleclick (.NET 2.0)

Rate me:
Please Sign up or sign in to vote.
4.62/5 (12 votes)
9 Jul 2007CPOL2 min read 116.8K   1.4K   35  
This is a small but handy tool I'm using everyday. It converts a middle mouse button click into a left mouse button double click.
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace MBtn2DblClick
{
	// C#
	// All methods must be contained in a class.
	// This class is added to the namespace containing the Form1 class.
	class StartUp
	{

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		//  [STAThread]
		public static void Main() {
			Process aProcess = Process.GetCurrentProcess();
			string aProcName = aProcess.ProcessName;

			if (Process.GetProcessesByName(aProcName).Length > 1) {
				MessageBox.Show("The application '" + aProcName + "' is allready running !!!", "Application allready running", MessageBoxButtons.OK, MessageBoxIcon.Stop);
				Application.Exit();
				return;
			}

			// Instantiate a new instance of Form1. (but do not show)
			Form1 f1 = new Form1();
			System.Windows.Forms.Application.Run();
		}
	}
}

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
Software Developer (Senior)
Switzerland Switzerland
programmer and software junkie since 1991 zurich switzerland

Comments and Discussions