IE6 and copy function not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello !

I use Borland C++ Builder, and I use the TCppWebBrowser component, which is
a wrapper around IE. The code I will post will be BCB, but it should be
easily understandable to people familiar with IE.

Before upgrading to WinXP SP2, to following code was working well :
// select all
Browser->ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT);
// copy to the clipboard
Browser->ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT);
// unselect everything
Browser->ExecWB(OLECMDID_CLEARSELECTION, OLECMDEXECOPT_DODEFAULT);

However, since I upgraded to SP2, the "copy" line does not work anymore...

I tried another approach using something like :
Variant vBody = vDocument.OlePropertyGet("Body");
Variant vTextRange = vBody.OleFunction("CreateTextRange");
vTextRange.OleProcedure("Select");
Variant vResult = vTextRange.OleFunction("ExecCommand","Copy");

But vResult returns always false, and nothing is copied to the clipboard.

Is there something I missed ?

Thanks for advance for your help !
 
Check that the Copy and Paste commands are enabled on your menu. If they are
not then go to the internet options control panel and select the security
tab. Edit your security settings for the zone.. There you will find a
setting for Miscellaneous - Drag and drop or copy and paste files, check to
see that you have enable or prompt selected.
 
mmm . I was wrong I think.... Maybe your permissions or the document
itself - contenteditable attribute?
 
Hello !

I tried the first approach, but it was enabled. I tried to set it to prompt,
but the result is the same.

ContentEditable or DesignMode are set to inherit. I tried setting them to On
or Off, but this didn't change anything.

However, something that's strange is that the Copy command of the contextual
menu does not work...
 
I am only guessing but the only other thing I can think of are IE
Permissions. I had a look at some doco I have but there doesn't seem to be
permissions for allowing copy and paste of web documents. I remember seeing
something about XP using a different approach to permissions but I have to
reboot and change my disk to find out about that.
The only other thing I can think of is a piece of java code like
onselectionstart="return false;"
in the body tag. You should be able to test that by checking the selection
length or loading about:blank and doing the select/copy thing. Of coarse you
can't copy from an embedded frame. One trick to hide html code is to place
full sized iframe between the html tags without a body.
I am assuming this is occuring only on a certain page or all documents?
 
Hi.
Hope this thread ist not outdatet.
I had exactly the same problem.

If you place a

OleInitialize(NULL);

for example in the FormCreate event everything should work fine

(Was more then 2 Days to find the problem)
 
Back
Top