title: How to change screen resolution in DirectX 9
body: <p>I'm trying to write a program using DirectX 9. As a part of this program I need a way to change screen resolution i.e. height and width for the DirectX device. I have a pointer to my <code>LPDIRECT3DDEVICE9</code> stored, and I need a function that looks like this:</p>
  
  <pre><code>void SetResolution(int x, int y) {
  // some code that actually changes the resolution
  }
  </code></pre>
  
  <p>Surprisingly, I failed to find it on the internet. I also found <a href="https://stackoverflow.com/questions/14278502/changing-resolution-in-directx9">this</a> thread on this site, but the accepted answer is very vague and looks like a mix of WinAPI and DirectX.</p>