TINASOFT
Log usage data from TinySoft EasyCafe server to a csv file . Capture the data using a background application that uses SetWindowsHookEx to detect messages and sets up a callback function to handle the message.
1 Create a thread that checks if the easy server is running every 5 seconds.
If a stop is detected, perform cleanup.
If a start is detected get process id and handlers and set up hooks.
2 Create a "state machine" with around 4 states that captures a particular sequence of events from the easy server process so that only one type of time sold is recorded and others ignored. The state machine will be reset in case one of 6 conditions mentioned in the document are encountered.
3 Save the time recorded in CSV format.
I have over 8 years experience in C++/Windows programming.
Sample code overview for the process using SetWindowsHookEx is below:
#include <Windows.h>
HHOOK _hook;
KBDLLHOOKSTRUCT kbdStruct;
// This is the callback function that is called when there is a message
LRESULT __stdcall HookCallback(int nCode, WPARAM wParam, LPARAM lParam)
{
// Your message parsing code and writing to csv file happens here
return CallNextHookEx(_hook, nCode, wParam, lParam);
}
void SetHook()
{
// Set the hook and set it to use the callback function above
if (!(_hook = SetWindowsHookEx(MESSAGE NAME, HookCallback, NULL, 0)))
{
MessageBox(NULL, "Failed to install hook!", "