Solved

Trying to track the number of times a program has been executed from the Quick Launch toolbar.

Posted on 2009-07-07
3
317 Views
Last Modified: 2012-05-07
I need to track the number of times over a time period that a program has been launched from the Windows Quick Launch toolbar. Additionally I need to know the last access time, etc. I need a method in C# to acomplish this either by reading the registry or by obtaining the information from the toolbar itself.

Thanks
0
Comment
Question by:iolodev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 24803585
Replace the quick launch short cut with a counting app that will launch the app.
I.e. instead of the shortcut staring 'app'. It runs an incrementing script which  starts the program.
I do not believe there is a registry or anything that windows tracks that deals with which short cut was clicked on to launch an application.

example in logic for bat file that will not work as written

@@echo off
Do some work to increment the count for the user clicking this short cut
start the application

0
 
LVL 4

Expert Comment

by:pepepaco
ID: 24817250
if you dont have control or source code of the desired application you must create the launcher  as arnold suggest, you can also create a service or always running monitor that detects if certain process is running and do almost the same thing. Both ways are easy.

Create a launcher in C# application to do everything you need.
1. Launch the application.
2. Count the # times.
3. Record the datetime.

OR

to Create the Service.
1.create Run and stay in memory program. (windowless)
2.make the application search for certain running process and record the time when it was found
3. check if the desired process goes off and record that time also.
4.to know the # times it went on off just check how many times it pass from off to on,
5. you will know also how much time it was running and when was the last running time.




--examples from http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx
--Example 1. Running a command line application, without concern for the results:
 
private void simpleRun_Click(object sender, System.EventArgs e){
 System.Diagnostics.Process.Start(@"C:\listfiles.bat");
}
--Example 2. Retrieving the results and waiting until the process stops (running the process synchronously):
 
private void runSyncAndGetResults_Click(object sender, System.EventArgs e){
 System.Diagnostics.ProcessStartInfo psi =
   new System.Diagnostics.ProcessStartInfo(@"C:\listfiles.bat");
 psi.RedirectStandardOutput = true;
 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
 psi.UseShellExecute = false;
 System.Diagnostics.Process listFiles;
 listFiles = System.Diagnostics.Process.Start(psi);
 System.IO.StreamReader myOutput = listFiles.StandardOutput;
 listFiles.WaitForExit(2000);
 if (listFiles.HasExited)
  {
  string output = myOutput.ReadToEnd();
  this.processResults.Text = output;
 }
}
 
//check for a running process:
//Example from http://www.dreamincode.net/code/snippet1541.htm
//Namespaces we need to use
using System.Diagnostics;
 
public bool IsProcessOpen(string name)
{
	//here we're going to get a list of all running processes on
	//the computer
	foreach (Process clsProcess in Process.GetProcesses) {
		//now we're going to see if any of the running processes
		//match the currently running processes. Be sure to not
		//add the .exe to the name you provide, i.e: NOTEPAD,
		//not NOTEPAD.EXE or false is always returned even if
		//notepad is running.
		//Remember, if you have the process running more than once, 
		//say IE open 4 times the loop thr way it is now will close all 4,
		//if you want it to just close the first one it finds
		//then add a return; after the Kill
		if (clsProcess.ProcessName.Contains(name))
		{
			//if the process is found to be running then we
			//return a true
			return true;
		}
	}
	//otherwise we return a false
	return false;
}
 
 
//hope this help.

Open in new window

0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question