title: SendInput MOUSEEVENT_MOVE causes screen flickering
body: <p>So I am trying to write a program in c++, which moves mouse cursor as if user moved mouse.
  I have something a piece of code, which looks like this:</p>
  
  <pre><code>std::atomic&lt;bool&gt; exit_condition = false;
  
  std::random_device rd;
  std::mt19937 gen(rd());
  std::uniform_int_distribution&lt;&gt; ud(-20, 20);
  void move_mouse() {
      while (!exit_condition) {
          INPUT input;
          input.type = INPUT_MOUSE;
          input.mi.mouseData = 0;
          input.mi.dwFlags = MOUSEEVENTF_MOVE;
          input.mi.dx = ud(gen);
          input.mi.dy = ud(gen);
          SendInput(1, &amp;input, sizeof(input));
          std::this_thread::sleep_for(100ms);
      }
  }
  </code></pre>
  
  <p>The thing is, when the program reaches this loop, screen starts flickering. </p>
  
  <p>I have second display connected to my laptop through HDMI cable and it gets completely turned off while laptop's display turns on/off every (what I believe) few cycles.</p>
  
  <p>Mouse moves, tho. So the program does what I want, kind of...</p>
  
  <p>Does anyone knows what is going on there? Can you, please, help me to understand the underlying problem?</p>
  
  <p>One more thing, the following code has the same effect:</p>
  
  <pre><code>void move_mouse() {
      INPUT input;
      input.type = INPUT_MOUSE;
      input.mi.mouseData = 0;
      input.mi.dwFlags = MOUSEEVENTF_MOVE;
      while (!exit_condition) {
          input.mi.dx = ud(gen);
          input.mi.dy = ud(gen);
          SendInput(1, &amp;input, sizeof(input));
          std::this_thread::sleep_for(100ms);
      }
  }
  </code></pre>
  
  <p>I use MS Visual Studio 2019 on Windows 10 machine to build my "solution". Switching from x32 to x64 build config doesn't work.
  _MSC_VER is 784. _MSC_FULL_VER is b78391c. I don't know if it is relevant.</p>
  
  <p>// EDIT:
  I fixed flickering by using <code>mouse_event</code>:
  <code>mouse_event(MOUSEEVENTF_MOVE, ud(gen), ud(gen), 0, NULL);</code></p>
  
  <p>But the question remains: why?
  When I add <code>input.mi.dwExtraInfo = NULL;</code> and use <code>SendInput</code> flickering still occurs.
  What else am I missing?</p>