title: How to resolve linking error for GetSystemMetrics()?
body: <p>I'm attempting to use the following to get the height &amp; width of the main display:</p>
  <pre><code>#include &lt;winuser.h&gt;
  size_t width = (size_t)GetSystemMetrics(SM_CXBORDER);
  size_t height = (size_t)GetSystemMetrics(SM_CYBORDER);
  </code></pre>
  <p>However, it's failing on an unresolved externals link error (<code>LNK1120</code>). I've tried linking to user32.lib (as documented <a href="http://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx" rel="nofollow noreferrer">here</a>), and received the same error, as well as linking to wmbase.lib (as documented <a href="http://msdn.microsoft.com/en-us/library/aa929225.aspx" rel="nofollow noreferrer">here</a>), and received the error that wmbase.lib does not exist! What am I doing wrong?</p>
  <p>Note that I am only using plain-ol' C — not C++. Is this the right function to use to get the screen resolution (in pixels) of the main display?</p>
  <p>I am attempting to compile this on MSVC at the moment, but would prefer a solution portable to other compilers.</p>
  <p>Thanks.</p>
  <h3>Edit</h3>
  <p>So it looks like the parameters I was looking for were <code>SM_CXSCREEN</code> and <code>SM_CYSCREEN</code>, not <code>SM_CXBORDER</code> and <code>SM_CYBORDER</code>. However, I still can't manage to get this to compile.</p>
  <p>Here is the actual error if that clarifies anything (when linked to user32.lib):</p>
  <pre><code>screen.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function _getMainDisplaySize
  build\lib.win32-2.6\foomodule\bitmap.pyd : fatal error LNK1120: 1 unresolved externals
  error: command '&quot;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe&quot;' failed with exit status 1120
  </code></pre>
  <p>(I am attempting to compile a Python/C module so that's why you see the weird directories)</p>