title: Why EM_SETMARGINS does not work under Windows 7?
body: <p>I have a compound visual control which consists of edit box and a drop down button. The drop down button is not a windowed control and is drawn over edit box. I limit edit's width with following call:</p>
  
  <pre><code>SendMessage(Handle, EM_SETMARGINS, EC_RIGHTMARGIN, 
    (DropDownButtonWidth + 2) shl 16);
  </code></pre>
  
  <p>It works fine under Windows XP but doesn't work under Windows 7. In latter case, when focused edit box overlap dropdown button and erases its image.</p>
  
  <p>What would be correct way of limiting edit box rect under both operation systems?</p>
  
  <p>PS: I also tried another approach:</p>
  
  <pre><code>  SendMessage(Handle, EM_GETRECT, 0, LongInt(@Loc));
    Loc.Bottom := ClientHeight + 1;  
    Loc.Right := ClientWidth - FButton.Width - 2;
    Loc.Top := 0;
    Loc.Left := 0;
    SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc));
  </code></pre>
  
  <p>But it doesn't work for Windows 7 either.</p>