Timesheet App + 3rd Place = $100

For those of you that read this blog… And saw my previous post about peak… I entered a timesheet application that I had written for human computer interface design class and ended up with 3rd place! Even so I was quite surprised at the level of interest in the application by some of the faculty and several students who have part time jobs here at Neumont.

The project started off as solution to a problem: How to get people who are paid on a per hour basis and who have their own development machine, to keep accurate timesheets.

I know that people have trouble remembering to consistently fill out a timesheet every day and for every break, it’s not a problem with the person themselves, but just that people are not perfect and do forget things from time to time. Currently, there are two methods of keeping track of time: One is simply to fill out a form every day (or excel document, or some form of tabular information) listing off the time you came in and the time you left, and then totaling the time on the form to get a total time. The second is a ‘clock in’ and ‘clock out’ program where you will either log in or have some form of clicking ‘start timer’ and ‘stop timer’. Some way’s are combinations of all of the above.

I wanted an application that was so simple to use, so unobtrusive that you would hardly even notice you were using it, and something that would keep a detailed record of my activity. I started out with the basic assumption that when a person was active on their computer that they were ‘working’ and that if they left for more than say, 10 minutes that they were ‘not working’. That being said, I quickly realized that there would always be exceptions to this, an hour long meeting, an extended time discussing or planning out a project on a white board… etc. So at the very beginning of the project I knew I need to have a simple, unobtrusive, way to handle exceptions to the normal workflow during the day.

[ This next section gets technical ]

The base of the application relied on hooking into the global mouse and keyboard events via Win32 DLL’s so that I was able to determine when a user is active on their computer. The application disappears into the system tray and keeps a running variable of the last time an action was performed. When a new action is performed it compares the time the new action was performed the previous action. If the difference is greater than a specified period of time (Which is stored in the application settings) the application pops up a message box to the user and asks them if they were working or not and provided an space to enter an optional comment. It then creates two time period segments, the first is for the time they were active up until the start of the activity gap, the second is from the start of the activity gap to the end of the activity gap. It then saves the timesheet and disappears again.

[ End technical section ]

The essence of this program is that it only asks ‘were you working?’ when you’ve been inactive from your computer during your specified working hours. Otherwise you would never even notice that the application existed. For me it’s perfect because it’s something that’s unobtrusive enough that I could run it on startup and just forget about it. It’s detailed because it asks you about exceptions, and it’s robust and stable.

Something that I was really intrigued by was the verity of ideas and features that people wanted for different things. If I decide to continue working on this (which I may) there are several core features that I still need to add. After that, I am thinking that I’ll add ‘aspects’ to the program; an aspect being not a ‘re-skinning’ but a re-skin plus additional functionality. For instance, one of the big ideas was being able to track application usage and to be able to record which applications were being used for how long and at what time. Another was the ability to categorize their time use. A third was the ability to have multiple users working on the same computer. I’m still going to have to work a lot of these issues out and figure out what’s going to be in the core project and what’s going to be included in the various ‘aspects’ of the program.

It’s an interesting project, and I’ll probably keep playing with it and adding additional functionality and ideas. If you’re interested in it, let me know, get in touch, suggest ideas. Who knows… maybe I’ll let you beta test ;)

PEAK Challange

As I mentioned in my previous post I’m entering the PEAK challenge put on by Neumont University. As a senator for Neumont USG (United Student Government) I was asked to do the poster that’s going to go up around the school advertising PEAK to get people to come and take a look at all the projects. At last count there were approximately 12 projects total, which is a big step up from last quarter.

One of the newest / coolest things about this particular PEAK Challenge (Which has been known in the past as the Neumont Summit Awards) is that the judging is being done by the companies that are sponsoring it! Now, I don’t know about you, but this is a great way to show off what you can do, what Neumont has taught you, and to make an impression on companies and people that you may be interviewing with at some point.

Peak Challange Poster

So… What do you all think?

Hooking Win32 DLL’s

Earlier today I was struck by pecular problem with the application I had been working on for PEAK challange, which is Neumont‘s bi-annual student competition where everyone who signs up has a chance to show off projects they or a team of theirs has done over the last year. It’s sort of a science fair concept put on by the Neumont Student Government (USG).

But… that aside, hooking Win32 DLL’s.

Alright, the program I’m working on runs in the background of the computer and records when your active based off of the mouse movement and keyboard input. This program will then automatically fill out a time sheet based off of the time you were active on your computer without the user having to do anything. The problem I was running into was, if you had been inactive on your computer for, lets say, 15 minutes (It’s configurable), when you come back it will ask you if you were working away from your computer or if you were taking a break or what. It then records the times and dissipates into the background. In order for this to work effectively however, I needed the popup box to override all the current active windows and be on top of them. This presents a problem, because .NET applications are built to be internal and well ‘packaged’ into their own little container that prevents them from causing issues with other applications. Normally this is a good thing, but for my task I needed to FORCE my window overtop of all the others when it wasn’t in focus. After several frustrating hours of trial and error, and countless forums, semi-related tutorials I finally decided that I had to hook into the User32.dll functions to get the behavior I needed, namely, forcing my dialog box on top of any and all other windows.

So, here is the rather short final set of methods that can be used to set focus to any windows form over all the other applications using unmanaged Win32 calls.

 
//CLR   wrapping of unmanaged functions
public static int GetWindowHandle(System.String WindowTitle)
{
        //a return value of 0 indicates that the function did not find the window
        return FindWindow(null, WindowTitle);
}
public static void SetWindowFocus(int windowHandle)
{
        SetForegroundWindow(windowHandle);
}
 
 
#region Unmanaged USER32 Functions
 
//DLL external functions hitting User32.dll
 
[DllImport("User32.dll")]
private static extern Int32 FindWindow(String lpClassName, String lpWindowName);
 
[DllImport("User32.dll")]
private static extern Boolean SetForegroundWindow(Int32 hWnd);
#endregion