title: How can I fix "Cannot open clipboard: Access Denied" errors?
body: <p>I am using the following code to copy text to the clipboard:</p>
  
  <pre><code>  Clipboard.Open;
    try
      Clipboard.AsText := GenerateClipboardText;
    finally
      Clipboard.Close;
    end;
  </code></pre>
  
  <p>Seemingly at random I get "Cannot open clipboard: Access Denied" errors. I'm guessing that these errors are caused by other application locking the clipboard, but I never seem to be doing anything with other applications that should cause the locks.</p>
  
  <p>Strangely my users seem to be reporting more of the errors with Vista and Windows 7 than with XP.</p>
  
  <p>Is there a way to check if the clipboard is locked before trying to access it?</p>