khairil
asked on
Disable Select All (CTRL + A) and Copy (CTRL + C) in WebBrowser Component in VB6
I have developed an application using Webbroswer control (which inherit Internet Explorer) as main interface. The application is in VB6 - upgrade to .net is not the choice. I like user to access web page contain it load but do not want them to copy the content.
I've successfully disable mouse context menu, but user still be able to press CTRL to select all and copy the content. How can I prevent this? Is there VB6 code that can prevent user from pressing CTRL + A and CTRL + C, without other side effect to the application (such disable select all in text box)?
-khairil-
I've successfully disable mouse context menu, but user still be able to press CTRL to select all and copy the content. How can I prevent this? Is there VB6 code that can prevent user from pressing CTRL + A and CTRL + C, without other side effect to the application (such disable select all in text box)?
-khairil-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Already add the type lib for that and it works like CHARM. Thanks a lot man. User still can do selection by dragging mouse pointer but they cannot copy it now.
-khairil-
Already add the type lib for that and it works like CHARM. Thanks a lot man. User still can do selection by dragging mouse pointer but they cannot copy it now.
-khairil-
Try the following code:
Private WithEvents doc As HTMLDocument
Private Sub WebBrowser1_DocumentComple
Set doc = WebBrowser1.Document
End Sub
Private Sub doc_onkeydown()
Dim eventObj As IHTMLEventObj
Set eventObj = doc.parentWindow.event
If eventObj.ctrlKey And ((eventObj.keyCode = vbKeyA) Or (eventObj.keyCode = vbKeyC)) Then
eventObj.returnValue = False
End If
End Sub