Help me! problem "if"
Oct 1, 2013 at 5:49pm UTC
Hello, I am a beginner and I have a problem in my code. It compiles but I is not the expected result. the condition does not. You have a solution?
Sorry if there are mistakes, I'm french and I translated with google.
int x;
ofstream oFile ("log.txt", ios::out | ios::app);
HWND myHandle,saveHandle;
char myText[300];
wchar_t str[50];
{
myHandle=GetForegroundWindow();
if(saveHandle != myHandle) {
time_t now = time(NULL);
struct tm * tm = localtime(&now);
char date[64];
strftime(date, sizeof date, "%A, %B %d, %Y %H:%M:%S", tm);
oFile << "\n";
oFile << "\n";
oFile << date << ":" << endl;
::GetWindowTextA(myHandle,myText,sizeof myText);
oFile << myText << endl;
oFile << "\n";
saveHandle = myHandle;
}
HANDLE clip,saveclip;
if (OpenClipboard(NULL)) {
clip = GetClipboardData(CF_TEXT);
CloseClipboard();
HERE --> if(saveclip != clip) {
string text;
text = (char*)clip;
oFile << text << endl;
saveclip = clip;}
}
}
oFile.close();
}
Thank you !
Last edited on Oct 1, 2013 at 6:20pm UTC
Topic archived. No new replies allowed.