0

I am running the following piece of code in Delphi :-

            procedure TWebBrowserFrame.CopyToClipboard;
            var
               doc : IHTMLDocument2;
            begin
              SelectAll;//doc.execCommand('SelectAll', false, 0);
              doc := browser.document as IHTMLDocument2;
              if (doc <> nil ) then
              begin
                doc.execCommand('Copy', false, 0);
              end;
            end;

I am trying to copy the contents of Ihtmldocument2 component to clipboard. This code is running on some systems but not working on others.It's not running on windows 2008server r2 and few windows 7 machine. I see on all systems that the content gets highlighted (so selectAll should be running).But the content is not copied to clipboard. I have tried the stated on https://msdn.microsoft.com/en-us/library/aa663363.aspx . I have ensured dhtmled.ocx and triedit.dll is registered (I am not sure about the version though). Also I explored the process happening through procmon.exe. I saw on the machine where copyto clipboard is successful triedit.dll is getting called more times than in the machine where it is not working.Also there is no call to mshtml.dll in the machine where it is working but there is a call(or two) on the machine where it is not working.

Can anyone please suggest any solution or workaround for this problem?Also if there is any other way to copy to clipboard from browserframe directly? thanks!

jetty
  • 859
  • 2
  • 17
  • 37

0 Answers0