title: Code dealing with windows clipboard don't work on some computer
body: <p>i wrote this program for a friend of mine
  It's purpose is to save every text you copy into a file</p>
  
  <p>On my pc the program work fine but on my friend pc it wont copy all the line</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;stdio.h&gt;
  
  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) &lt;= 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, &amp;irInput, 1, &amp;InputsRead);
      return irInput.Event.KeyEvent.wVirtualKeyCode;
  }
  </code></pre>
  
  <p>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</p>
  
  <p>EDIT: my friend use Windows 8 64bit instead i use 7 at 64bit, could be this the problem?</p>