none
IHTMLTxtRange.pasteHTML duplicates text copied from notepad RRS feed

  • Question

  • In IE 9 the below code work perfectly fine but in IE11 when i copy from a note pad and pasted it is pasting the text twice.

    The control in which we are pasting is the TWebBrowser

    Code Briefing:

    if ClipBoard.HasFormat( CF_HTML ) then process the request//No issue here

    if ClipBoard.HasFormat( CF_RTF ) then process the request//No issue here

    else   // we don't have HTML in the clipboard and process as Text!!!// Issue starts from here
        lHTML := ClipBoard.AsText;

        IHTMLTxtRange.pasteHTML( lHTML );

    if (FOleInPlaceActiveObject <> nil) then
        begin
          // Pass the message onto the web browser.
          // not with the arrows and back space.
          // Somehow they get processed 2 times
          if not( ( Msg.message= WM_KEYDOWN ) //or (Msg.message= WM_PASTE )
            and (Msg.wParam in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_RETURN, VK_BACK])) then
            fOleInPlaceActiveObject.TranslateAccelerator (Msg);
          Handled := true;
        end;

    When we analyzed ,

     IHTMLTxtRange.pasteHTML( lHTML );  and Clipboard.Paste could be firing and causing the paste twice.

    But in IE9 this was not pasting twice , is there any change on clipboard.paste in IE 11.

    Could you please help us by proving your inputs in solving the issue.

    Thanks 
    Sandeep

    Tuesday, July 28, 2015 12:27 PM

Answers