title: How do you detect XButton1 pressed with focusing any window?
body: <p>I want to make a background program that overrides my mouse button to do something I want(The concept is same as global hotkey). Especially when XButton1 (back button on the mouse) is pressed, I want to do some kind of macro work.</p>
  
  <p>I have tried many ways and made it work if the form is clicked with following codes,</p>
  
  <pre><code>Protected override void WndProc(ref Message m)
  {
     if (m.Msg == Hotkeys.Constants.MK_XBUTTONDOWN) // Hotkeys.Constants.MK_XBUTTONDOWN == 0x020B;
     { 
          // Do something
     }
  }
  </code></pre>
  
  <h1>I have got the number 0x020B from <a href="https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-xbuttondown" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-xbuttondown</a></h1>
  
  <p>Folowing codes are what I did to make global hotkeys, but couldn't figure out how to make global mouse click,</p>
  
  <pre><code>if (m.Msg == Hotkeys.Constants.WM_HOTKEY_MSG_ID) //WM_HOTKEY_MSG_ID = 0x0312
  {
      int id = m.WParam.ToInt32();
      if (GetActiveWindowTitle() == "I want to make global hotkeys to do certain work at this program name")
      {
          // Do something
      }
  }
  </code></pre>
  
  <p>Can I get at least some key words for overriding my XButton1 or XButton2?</p>