954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with windows Services

Hello there, I recently decide to learn and code Windows Services, After I learned the bare
basic I thought I would make a program that logs the users program usage every 60 seconds
I have coded the same thing without putting it in a service but apparently Services work differently
could somebody help please?

//hTarget and hTemp are global variables
void UpdateForegroundHWND()
{
    hTemp = GetForegroundWindow(); 
    if(hTemp == NULL) // If no foreground Window record no activity
    {
        WriteToLog("No Window Currently Used...\n");
        return;
    }
    if(hTarget == NULL) // if target is 0 the set the target as the Handle to the Foreground WD
        hTarget = hTemp; 
    if(hTarget != hTemp) // if target handle != temp handle set target to temp
        hTarget = hTemp;
}


Thank you very much, all help is appreciated.

Disclaimer, I know it seems weird but I am not writing malware or something. It is just for fun & learning

stavros141
Newbie Poster
10 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: