Script2EXE Home How to Use Interface Buy Support Site Home

Butterfly (Window of Irregular Shape) - A Sample Programm Created with Script2EXE


A window does't has to be square. This program shows how to make a irregularly-shapped window.

HTML Source
<HTML>
<HEAD>
<script language="javascript">
function Init()
{
if(!window.external.SHW)
    return;
window.external.AllowContextMenu(false);
window.external.SetTopMostWindow(true);
window.external.SetWindowRgnFromImage("butfly.gif", true);
}

Init();


function showMenu()
{
if(!window.external.SHW)
    return;
if(window.event.button!=2)
    return;

var menu=window.external.CreateMenu();
menu.AddItem("About...");
menu.AddItem("");
menu.AddItem("Exit");
var s=menu.Show();
if(!s)
    return;

if(s=="Exit")
    {
    window.close();
    return;
    }
if(s=="About...")
    {
    var r=window.external.MessageBox("This program is created with Script2EXE by XUEBROTHERS.\r\n\r\nWould you like to visit the Web site of Script2EXE?", "yesno", "information", "Butterfly");
    if(r=="yes")
        window.external.ShellExecute("http://www.xuebrothers.net/sh/sh.htm");
    return;
    }
}

var moving=false;
var moveX=0;
var moveY=0;
var but=0;

function rememberButton()
{
but=window.event.button;
}

function moveBegin()
{
if(but!=1)
    return;
window.event.returnValue=false;
window.event.cancelBubble=true;
moving=true;
moveX=window.event.screenX;
moveY=window.event.screenY;
}
function move()
{
if(!moving)
    return;
var x=window.event.screenX;
var y=window.event.screenY;
var dx=x-moveX;
var dy=y-moveY;
moveX=x;
moveY=y;
window.moveBy(dx, dy);
}

function moveStop()
{
if(moving)
    moving=false;
}
</script>
</HEAD>
<BODY leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" bgColor="#000000" scroll="no"  ondragstart="moveBegin()"  onmousemove="move()" onmouseup="moveStop()" onmousedown="rememberButton()"> 
<img src="butfly.gif" title="Right click to show menu." onmousedown="showMenu()" style="cursor:move">

</BODY>
</HTML>