Print preview in context menu

  • Thread starter Thread starter Michele Locati
  • Start date Start date
M

Michele Locati

Hi ng!

I've got a little question: is there the possibility to access the
print preview with via the context menu? (very useful when working
with frames...)
I know it is possible in IE7, but for development reasons I have to
use IE6.

Many thanks!
Michele
 
If you can't find a simple method, try this:
Adding Entries to the StandardContextMenu:http://msdn2.microsoft.com/en-us/library/Aa753589.aspx

Very useful hint! Thank you!
I'll have to see if I can create a print preview there (in fact it
seems that I have to write a script:
"Set the default value of the key to the URL of the page that contains
the script you want the context menu entry to execute")

Thank you again
Michele
 
Ok! Work done! Here's my solution:

STEP 1) Create a new file called for example PrintPreviewByMenu.htm
and place it, for example, under C:\Program files. It should contain
the following text:

<script type="text/javascript" language="javascript">
var OLECMDID_PRINTPREVIEW = 7, oIE;
if(oIE=getIE())
oIE.ExecWB(OLECMDID_PRINTPREVIEW,0);
function getIE()
{
var oMyWin=null,oApp,oWins,oWin,k;
debugger
if(window.external)
oMyWin=external.menuArguments;
if(!oMyWin)
{
alert("Unable to get the current window");
return null;
}
try
{
oApp=new ActiveXObject("Shell.Application");
oWins=oApp.Windows();
for(k=0;k<oWins.Count;k++)
if(oWin=oWins(k))
if(oWin.document)
if(oWin.document.parentWindow==oMyWin)
return oWin;
alert("Internet Explorer object not found.");
return null;
}
catch(e)
{
alert(e.message);
return null;
}
}
</script>


STEP 2) Open regedit (Windows Registry Editor) and:
- Create a new key called for example "Print preview" (without
quotes) under
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
- Set its default value to the full path of the previous file. In our
example it is:
C:\Program files\PrintPreviewByMenu.htm
- Create a new DWORD value called Contexts under the key just created;
set its value to 1

Done! Open a new Internet Explore window and right click: the menu
item is there and working.
Thanks for the hint!

Ciao
Michele
 
Back
Top