title: There is no "MouseButtons" information in "MOUSEMOVE" of 'winapi'
body: <p>I'm trying to implement LBUTTONDOWN-&gt;MOUSEMOVE-&gt;WM_LBUTTONUP using winapi in outfocus.
  But the &quot;MouseButtons&quot; information doesn't come.</p>
  <p><a href="https://i.stack.imgur.com/MpPub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MpPub.png" alt="enter image description here" /></a></p>
  <p>I want to simulate the same mouse click and move using winapi.</p>
  <p>I created a winform application to make sure winapi works. This form Event monitors mouse and keyboard input.</p>
  <p>Using</p>
  <blockquote>
  <p>SendMessage LBUTTONDOWN-&gt; MOUSEMOVE-&gt; WM_LBUTTONUP</p>
  </blockquote>
  <p>message has been sent.</p>
  <p>But my code doesn't give the button information during MOUSEMOVE.</p>
  <pre><code>[System.Runtime.InteropServices.DllImport(&quot;user32.dll&quot;)]
          public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);
  </code></pre>
  <p>Here is my code.</p>
  <pre><code>int x = 0;
  int y = 0;
  IntPtr lparam = IntPtr.Zero;
  
  x = 160;
  y = 500;
  lparam = new IntPtr(x | (y &lt;&lt; 16));
  SendMessage(hwnd_child, WM_LBUTTONDOWN, (int)0x0, lparam);
  
  Thread.Sleep(3000);
  
  //이벤트
  for (int i = 0; i &lt; 100; ++i)
  {
      //일반
      x = 160;
      y = 500 - i;
      lparam = new IntPtr(x | (y &lt;&lt; 16));
      SendMessage(hwnd_child, WM_MOUSEMOVE, 0, lparam);
      //Thread.Sleep(10);
  }
  
  x = 160;
  y = 500 - 100;
  lparam = new IntPtr(x | (y &lt;&lt; 16));
  SendMessage(hwnd_child, WM_LBUTTONUP, (int)0x0, lparam);
  </code></pre>
  <p>Existing result (See Previous image)</p>
  <p>I want the below result
  <a href="https://i.stack.imgur.com/WRJCx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WRJCx.png" alt="enter image description here" /></a></p>
  <p><strong>2019-09-02 Added</strong></p>
  <p>I modified the code in the way of the answer.</p>
  <p>I checked the log through spy++.</p>
  <p>Modified code</p>
  <pre><code>//SendMessage -&gt; PostMessage
  PostMessage(hwnd_child, WM_MOUSEMOVE, MK_LBUTTON, lparam);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/c6XF8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c6XF8.png" alt="Result of modified code" /></a></p>
  <p>Desired result.</p>
  <p>Log obtained by dragging the mouse directly.</p>
  <p><a href="https://i.stack.imgur.com/fAQu3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fAQu3.png" alt="Log obtained by dragging the mouse directly." /></a></p>
  <p><strong>test program code</strong></p>
  <pre><code>private void FrmMain_MouseMove(object sender, MouseEventArgs e)
  {
      if (this.m_bMouseMoveEnabled == true)
      {
          this.SendLog(&quot;MouseMove&quot;
          , string.Format(&quot;Btn:{0}, X:{1}, Y:{2}&quot;
                          , e.Button
                          , e.X
                          , e.Y));
      }
  }
  </code></pre>
  <br />
  <br />
  <p><strong>2022-05-04 Update</strong></p>
  <p>I have created several test programs.<br />
  And I found the cause.<br />
  <br />
  The 'MOUSEMOVE' information of 'winapi' appears to be that of a physical mouse.<br />
  <br />
  I have &quot;MouseButtons&quot; when I hold down the physics mouse.<br />
  <br /></p>