| Document Path: | Home Page / Programming / HTML2EXE / Hooks & Callbacks |   |
Shell Tray Icon callback function protype:
function MyShellTrayCallback(button)
{
//button=1: left mouse button down; 2=middle mouse button down; 3=right mouse button down
}
Each application can install only one icon on the system tray. To install:
window.external.Application.InstallShellTrayIcon(tip, iconResourceName, MyShellTrayCallback);
Hot key callback function protype:
function MyHotKey(vKey, altKey, ctlKey, shiftKey, winKey)
{
}
Example: How to register a hot key Alt+F12:
var hk=window.external.System.CreateHotKeyObject(); hk.Register(MyHotKey, 0x7b, true, false, false, false);
Message hook callback function protype:
function MyMessageHook(msgobj) { }
You can install Message Hooks at three different levels, but don't simply understand this as that a high-level hook covers all messages that a lower-level hook can get:
var mhkView=window.external.Frame.View.MessageHook; var mhkToolbar=window.external.Frame.Toolbar.View.MessageHook; var mhkSidebar=window.external.Frame.Siderbar.View.MessageHook; var mhkStatusbar=window.external.Frame.Statusbar.View.MessageHook;
var hkFrame=window.external.Application.MainFrame.MessageHook;
var hkApp=window.external.Application.MessageHook;
The callback function for popup menu is optional. It is called when the user moves the mouse over the menu or leaves the menu. This give you a chance to update the status-text to give the user more information about the menu commands.
Popup menu callback function protype:
function OnMenuSelect(cmdID)
{
//cmdID 0=mouse pointer not on the menu, -1=the menu is closed, other=command id the mouse pointer is on.
}
The Frame Menu requires three callback functions:
Frame Menu callback function protypes:
//called when the user clicked the menu command
function OnExecuteMenuCommand(frameMenuObj, cmdID)
{
}
//called when the user is selecting menu command.
function OnMenuSelect(frameMenuObj, cmdID)
{
//cmdID 0=mouse pointer not on the menu, -1=the menu is closed, other=command id the mouse pointer is on.
}
//called when the user begins to use the menu
function OnInitMenu(frameMenuObj)
{
//enable/disable menu command items
}
Web Browser event callback function protype:
function MyWebEventHanlder(webevent) { }
Web Browser Events hook can be installed on two level:
window.external.Frame.View.WebEventHandler=MyWebEventHanlder; window.external.Frame.Toolbar.View.WebEventHandler=MyWebEventHanlder; window.external.Frame.Siderbar.View.WebEventHandler=MyWebEventHanlder; window.external.Frame.Statusbar.View.WebEventHandler=MyWebEventHanlder;
window.external.WebEventHandler=MyWebEventHanlder;
SendMessageCallback callback function protype:
function MyCallback(hwnd, message, lresult)
{
}
SendMessageCallback callback function protype:
function MyCallback(hwnd, message, lresult)
{
}
The callback functions must be assigned to a module, instead to a function. In the moudle, the calback functions must be defined as showed by the protypes:
function OnConnectionAccepted(tcpServerObj, tcpClientObject) { }
The callback functions must be assigned to a module, instead to a function. In the moudle, the calback functions must be defined as showed by the protypes:
function OnConnected(tcpClientObject) { } function OnConnectFailed(tcpClientObject) { } function OnPeerDisconnected(tcpClientObject) { } function OnDataReceived(tcpClientObject) { } function OnDataSent(tcpClientObject) { } function OnIdle(tcpClientObject) { }
The callback functions must be assigned to a module, instead to a function. In the moudle, the calback functions must be defined as showed by the protypes:
function OnDataReceived(udpObject, ip_b1, ip_b2, ib_b3, ib_b4, port, buffer) { }
Download callback function protype:
function MyCallback(progrress, total)
{
//return false to cancel the job
}
Download is a method of window.external.Application.Internet
HTTPRequest callback function protype:
function MyCallback(textInfo, progrress, total)
{
//return false to cancel the job
}
HTTPRequest is a method of window.external.Application.Internet
ZIP Writer callback function protype:
function ProgressCallback(entryName, entryIndex, totalEntries, entryProgress, entrySize)
{
//return value: 1: continue to decompress; 0: skip this entry; -1: abort the process
}
ZIP Writer callback function protype:
function ProgressCallback(filePathName, entryName, fileAttributes, progress, total)
{
//return value: 1: continue to decompress; 0: skip this file or folder; -1: abort the process
}
ZIP Writer callback function protype:
function ProgressCallback(infoText, progress, total)
{
//return value: <=0 abort the process; >0: continue
}
ZIP Writer callback function protype:
function ProgressCallback(infoText, progress, total)
{
//return value: <=0 abort the process; >0: continue
}