i wrote this program for a friend of mine It's purpose is to save every text you copy into a file
On my pc the program work fine but on my friend pc it wont copy all the line
#include <windows.h>
#include <stdio.h>
using namespace std;
int GetKeyboardInput(HANDLE hstdin);
int main()
{
    HANDLE clip;
    char* lastClip = (char*) malloc(1024);
    char* currClip = (char*) malloc(1024);
    FILE* file;
    HANDLE hstdin;
    int key;
    hstdin = GetStdHandle(STD_INPUT_HANDLE);
    strcpy(lastClip, "");
    file = fopen("clipboard.txt", "w");
    if(file != NULL)
    {
        do
        {
            if (OpenClipboard(NULL))
                clip = GetClipboardData(CF_TEXT);
            if(clip != NULL)
            {
                if(strlen((char*)clip) <= MAXLEN)
                    strcpy(currClip, (char*) clip);
                else
                    strcpy(currClip, "String toooooo long");
                if (strcmp(currClip,lastClip) != 0)
                {
                    fprintf(file, "%s \n", currClip);
                    strcpy(lastClip, currClip);
                }
            }
            CloseClipboard();
            key = GetKeyboardInput(hstdin);
        }while (key != VK_ESCAPE);
        fclose(file);
    }
    else
        printf("Failed opening file");
    system("pause");
    return 0;
}
int GetKeyboardInput(HANDLE hstdin)
{
    INPUT_RECORD irInput;
    DWORD InputsRead = 0;
    ReadConsoleInput(hstdin, &irInput, 1, &InputsRead);
    return irInput.Event.KeyEvent.wVirtualKeyCode;
}
The code is very simple so i don't think it need explanation I cannot recreate the same circumstance [i tried to copy the same text, but it works for me] of the other pc so i think that there's a bug on the code
EDIT: my friend use Windows 8 64bit instead i use 7 at 64bit, could be this the problem?
