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