Roboblue
12-09-2006, 11:40 AM
We have had several discussions on disabling the right click (RC) on a Web Object. I have coded a couple of examples and some others have, also. None that I have seen or coded have satisfied me.
I was wanting to make an small e book viewer and since IE supports so many formats (.html, .txt, .jpg, .gif, .rtf, wave, .mid, and others if the system has the plugins), I thought I would use the Web object to display the books. The same principal applies for a product catalog, picture viewer, media player, etc. So disabling RC became a priority.
I still haven't came up with an elegant way to totally disable RC.
However, I thought, why not just replace the IE RC menu with my own custom menu? So, I did.
Here are two examples that I came up with.
The first one is just an RC disabler.
The second one is a custom menu example.
In the second one, I used WORM's powerful (and free:yes ) keystroke dll to provide an external page Search function. It also has the page loading animation effect (on the Refresh button) I recently did.
To see the code, look at the Page-On Mouse Button event.
T0 prevent the RC menu from popping up outside of the Web object, you need to set the e_X and e_Y co-ordinates (or the inside coordinates of the object). This is the way I did it.
to get e_X co-ordinates
Web object from Left position and Web Object width
e_X > (left) and e_X < (Left + Width)
to get e_Y co-ordinates
Web object from Top position and Web Object Height
e_Y > (Top) and e_Y < (Top + Height)
This function, RCPos(), is in Global. Just be sure to change the object name (in this case "web") to the object you want to get the inside co-ordinates to. This would be useful for a Tab browser and to use same the code project to project.
I am also going to work on disabling the copy to clipboard keystrokes so that there isn't a way to select and copy. With that disabled, you can select with the left mouse, but not copy with Ctrl+C. Anyone wanting to do this right now is welcome to post it. I will, when it's done.
I haven't tried this yet, but I bet the same code would work for other objects as well, (like the WMP).
I was wanting to make an small e book viewer and since IE supports so many formats (.html, .txt, .jpg, .gif, .rtf, wave, .mid, and others if the system has the plugins), I thought I would use the Web object to display the books. The same principal applies for a product catalog, picture viewer, media player, etc. So disabling RC became a priority.
I still haven't came up with an elegant way to totally disable RC.
However, I thought, why not just replace the IE RC menu with my own custom menu? So, I did.
Here are two examples that I came up with.
The first one is just an RC disabler.
The second one is a custom menu example.
In the second one, I used WORM's powerful (and free:yes ) keystroke dll to provide an external page Search function. It also has the page loading animation effect (on the Refresh button) I recently did.
To see the code, look at the Page-On Mouse Button event.
T0 prevent the RC menu from popping up outside of the Web object, you need to set the e_X and e_Y co-ordinates (or the inside coordinates of the object). This is the way I did it.
to get e_X co-ordinates
Web object from Left position and Web Object width
e_X > (left) and e_X < (Left + Width)
to get e_Y co-ordinates
Web object from Top position and Web Object Height
e_Y > (Top) and e_Y < (Top + Height)
This function, RCPos(), is in Global. Just be sure to change the object name (in this case "web") to the object you want to get the inside co-ordinates to. This would be useful for a Tab browser and to use same the code project to project.
I am also going to work on disabling the copy to clipboard keystrokes so that there isn't a way to select and copy. With that disabled, you can select with the left mouse, but not copy with Ctrl+C. Anyone wanting to do this right now is welcome to post it. I will, when it's done.
I haven't tried this yet, but I bet the same code would work for other objects as well, (like the WMP).