Symphony Technology have been looking to build a productivity tool that allows users to record a certain set of actions that involves mouse actions and keyboard strokes and play them back later.
The macro engine would need to be smart enough so it locate a window by different means to handle different scenarios like windows changing locations, changes to the window structure and related.
The client also wanted the component to have a .NET based API interface for integrating with other applications.
- Building a macro engine with a .NET interface is challenging as the component has to inject code print into all running applications which has compatibility issues in certain hook types with CLR involved, a native language would need to do this job.
- Building the runtime engine to be able to locate a window by various means.
InspirationGate first researched the idea of building an end to end .NET based solution where both the event listener and tracker were running under CLR, this proved ineffective for various reasons, the listener needs to be injected into running applications using a global hook by passing a function pointer to the .NET method which is called when an event occurs in an application process, this technique worked for some types of global hooks but didn’t work for journal hooks which are the primary method used for this task, that’s in addition to other performance implications.
From that point, we set out to build a half C++, half .NET platform, where the listener would be built totally in native C++ and the tracker would remain in C# thus achieving both goals of having a .NET based API while the real work is being handled by the native component.
The general implementation was to write a C++ component that would create a global hook running in either journal record or journal playback modes then communication between the C++ component and its .NET interface occurred by using a combination of a shared memory data segment and call backs.
Surrounding this framework was a number of components that facilitate window info retrieval, data management and related. Finally, a tool was created that allows the user to view a previously recorded session and alter or customize its actions.
The end result was a strong application capable of recording and play back user actions with a high degree of accuracy.
Required Workflow Diagram
Visual Studio 2005, .NET 2.0, C#, C++.
"InspirationGate have done a wonderful job. This project was quite challenging, and we are very pleased with the work that has been done. The code was well written, well commented, and worked exactly as we asked, in fact, even better. InspirationGate took our idea and through smarter design, created an application that was much more powerful than our original requirements described."
- Trevor Chandler, President