title: How to use SetWindowLong in C#?
body: <p>I use this function:</p>
  <pre><code>[DllImport ( &quot;user32.dll&quot; )]
  static extern int SetWindowLong ( IntPtr hWnd, int nIndex, uint dwNewLong );
  </code></pre>
  <p>and pass values from these:</p>
  <p><a href="http://pinvoke.net/default.aspx/Constants/Window%20styles.html" rel="nofollow noreferrer">http://pinvoke.net/default.aspx/Constants/Window%20styles.html</a></p>
  <pre><code>enum WindowLongFlags : int
  {
      GWL_EXSTYLE = -20,
      GWLP_HINSTANCE = -6,
      GWLP_HWNDPARENT = -8,
      GWL_ID = -12,
      GWL_STYLE = -16,
      GWL_USERDATA = -21,
      GWL_WNDPROC = -4,
      DWLP_USER = 0x8,
      DWLP_MSGRESULT = 0x0,
      DWLP_DLGPROC = 0x4
  }
  </code></pre>
  <p>So when I call it as:</p>
  <pre><code>SetWindowLong ( c, WindowLongFlags.GWL_STYLE, WindowStyles.WS_OVERLAPPED );
  </code></pre>
  <p>I get these errors:</p>
  <blockquote>
  <p>Argument 2: cannot convert from 'timoti.WindowLongFlags' to 'int'</p>
  <p>Argument 3: cannot convert from 'timoti.WindowStyles' to 'uint'</p>
  </blockquote>
  <p>Is the pinvoke signature wrong as I have seen different ones online or am I missing something else?</p>