title: User32 SetWindowLong accepts int instead long
body: <p>When I try to call a function from User32.dll in C#, SetWindowLong, nothing happens. I know why, but I don't know how to "repair" this.
  Here's a piece of code.</p>
  
  <pre><code>[DllImport("user32.dll")]
  public static extern long GetWindowLong(IntPtr hWnd, int nIndex);
  [DllImport("user32.dll")]
  public static extern long SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
  const int WS_EX_TOPMOST = 0x00000008;
  const int GWL_EXSTYLE = -20;
  public static bool IsWindowTopMost(int id)
  {
      return (GetWindowLong(GetHWNDById(id), GWL_EXSTYLE) &amp; WS_EX_TOPMOST) == WS_EX_TOPMOST;
  }
  public static void SetAlwaysOnTop(int id)
  {
      IntPtr hWnd = GetHWNDById(id);
      long actuallyStyle = GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_TOPMOST;
      SetWindowLong(hWnd, GWL_EXSTYLE, (int)actuallyStyle));
  }
  </code></pre>
  
  <p>IsWindowTopMost works fine, but SetAlwaysOnTop does not. After a quick examination of the code, I found something interesting. Variable "actuallyStyle" after GetWindowLong is equal to 4295295232, after OR operation 4295295240. Here is the problem, function SetWindowLong accepts as dwNewLong a Integer. When I change int with long in the definition of SetWindowLong, pinvoke throws an error, because "unmatched function and target function".</p>
  
  <p>How does it get around?</p>