Menu

RawFunctions

Anonymous

Raw Functions

The following functions have not yet been added to the wbc.js wrapper, but are available in raw form.
Note that callbacks in these functions must be specified by function name (in a string) rather than as a bound JS function.
To call a raw function prefix it with "external." . For example var ret = external.Uisdk_GetSysTrayRect();

References to "wbc" refer to the UI SDK process itself.

uisdk_CreateSysTrayMenu

  • Description: Creates popup menu and shows immediately in the tray.
  • reading: background with response/timeout callback.
  • Function: uisdk_CreateSysTrayMenu(menuItems, callback, llbackTimeout, timeout)
  • Arguments:
    • array menuItems - an array of objects. each item represents a menu item. Each object should expose the following members:
      • string Id - menu item Id
    • string Text - menu item text
    • bool isSeparator (optional) - if set to 'true' - the menu item is actually the separator (in that case all other members of that object are ignored)
    • bool isEnabled (optional) - if set to 'false' - the menu item is disabled. by default (if the option is not defined) - the menu item is enabled.
    • string callback - callback function name. That function is called when a menu item is selected by the user. The parameter passed to the callback will be the menu item chosen.
    • string callbackTimeout - callback function name. That function is called when the menu is removed due to timeout
    • int timeout - timeout value in seconds.
      Returns:
    • 'OK' if successful,
    • 'INVALID' if wrong parameters were passed
    • 'ERROR' if the menu cannot be created for some other reason.
      Notes:
    • The result of that function is: a popup menu is shown in the tray area.
    • Menu contains the items listed in the menuItems parameter.
    • If the user doesn't select any item within the defined timeout, the menu is removed, and the callbackTimeout function is called.
    • If the user selects a menu item, the callback function is called.

uisdk_GetSysTrayRect

  • Description: Returns the position and size of the system tray window
  • Threading: foreground/immediate
  • Function: uisdk_GetSysTrayRect()
  • Arguments: None
  • Returns: Rectangle representing the current position of system tray area:
    • int left
    • int top
    • int right
    • int bottom
    • int width
    • int height

uisdk_HttpPost

  • Description: Performs a HTTP POST request to the server.
  • Threading: background with callback.
  • Function: uisdk_HttpPost(url, postParams, callbackName)
    • string url - the remote URL
    • object postParams - the object that contains a number of Name/Value pairs to be passed as the HTTP 'POST' parameters to the server. For example, the object could be { 'username': 'admin', 'password': '12345' }
    • string callbackName - the JS callback function name
  • Returns:
    • 'INVALID' if invalid parameters were passed
    • 'ERROR' if an error occurred preventing the download process.
    • Otherwise returns the Thread ID of the download thread if the functions succeeds.
  • Callback: Progress object with the following properties
    • string func - equals to 'uisdk_HttpPost'
    • int threadId - the thread Id (the same as returned by the initial call to uisdk_HttpPost function)
    • string url - the remote URL (the same as passed to the uisdk_HttpPost function)
    • string status - the status string. Can be one of the following:
    • 'BUSY' - the operation is in progress
    • 'ERROR' - the operation was terminated or some error occurred
    • 'DONE' - the operation is successfully complete.
    • int httpStatusCode - the HTTP response status code (available only after the response is received)
    • string httpStatusText - the HTTP response status text (available only after the response is received)
    • array httpHeaders - array of HTTP response header strings (each member of an array - the line from the HTTP response header) - available only after the response is received
    • string body - the body section of the HTTP response (usually the HTML) - the body field is relevant only upon receiving the 'DONE' status.
    • string bodyBase64 - the body section of the HTTP response encoded as a base64 string.
    • float complete - the percentage showing the progress of the download process (from 0 till 100%). Because the total amount to upload/download is not always can be determined at the beginning - the complete field may not always show the actual percentage. But it is set to 100% when the download is successfully completed.
    • int totalSend - the total amount of data (in bytes) that is to be sent to the server.
    • int sent - the amount of data that is sent to the server so far (in bytes).
    • int totalReceive - the total amount of data (in bytes) that is to be received from the server.
    • int received - the amount of data that is received from the server so far (in bytes).
      Notes:
    • Additional headers can be passed during the POST by first calling uisdk_SetHTTPHeaders

uisdk_RegisterAccelerator

  • Description: Registers a keyboard shortcut callback function
  • Threading: foreground/immediate, with event callback
  • Function: uisdk_RegisterAccelerator(callback, key, isAlt, isCtl, isShift)
  • Arguments:
    • string callback - specifies the callback function name. The callback function is called each time the specified key-combination is pressed on the keyboard.
    • string key - the key-part of the key combination
    • bool isAlt - true if the ALT key is present in the key combination
    • bool isCtl - true if the CONTROL key is present in the key combination
    • bool isShift - true if the SHIFT key is present in the key combination
  • Returns:
    • "INVALID" if invalid parameters were passed
    • "ERROR" if any other error occurs.
    • "OK" if the key accelerator is successfully installed.
  • Callback: on key combination press, regardless of current application. An object with the following properties:
    • string func - the name of the function that initiated this callback (in that case it is equal to 'uisdk_RegisterAccelerator')
    • string keyPressed - the key that was pressed (from the registered key combination).
    • bool hasAlt - 'true' if the ALT key was pressed (if the ALT key was registered in the key combination)
    • bool hasCtl - 'true' if the CONTROL key was pressed (if the CONTROL key was registered in the key combination)
    • bool hasShift - 'true' if the SHIFT key was pressed (if the SHIFT key was registered in the key combination)
  • Notes:
    • Whenever the user presses the specified key combination the callback is called.
    • The accelerator is active until it is unregistered by the uisdk_UnregisterAccelerator function

uisdk_UnregisterAccelerator

  • Description: Unregisters the keyboard shortcut callback function created by uisdk_RegisterAccelerator
  • Threading: foreground/immediate
  • Function: uisdk_UnregisterAccelerator(key, isAlt, isCtl, isShift)
  • Arguments:
    • string key - the key-part of the key combination
    • bool isAlt - true if the ALT key is present in the key combination
    • bool isCtl - true if the CONTROL key is present in the key combination
    • bool isShift - true if the SHIFT key is present in the key combination
  • Returns:
    • "INVALID" if invalid parameters were passed
    • "ERROR" if any other error occurs.
    • "OK" if the key accelerator is successfully uninstalled.
  • Notes: none

uisdk_RegisterDropFilesCallback

  • Description: Allows the application to be the target/recipient of dragged/dropped files, or to unregister as such.
  • Threading: foreground/immediate, with event callback
  • Function: uisdk_RegisterDropFilesCallback(callback)
  • Arguments:
    • string callback (optional) - specifies the callback function name.
  • Returns:
    • "INVALID" if invalid parameters were passed, "ERROR" if any other error occurs.
    • "OK" is the callback is successfully installed/removed.
  • Callback: An object exposing the following properties
    • string func - the name of the function that initiated this callback (in that case it is equal to 'uisdk_RegisterDropFilesCallback')
    • object position - the position of the mouse pointer at the time a file was dropped during a drag-and-drop operation. Exposes 2 properties:
      • int x - the X coordinate
      • int y - the Y coordinate
    • array files - array of strings - contains the name(s) of dropped file(s) that result from a successful drag-and-drop operation.
  • Notes:
    • The function is called when the file is dropped onto the WBC window.
    • Specifying null or empty string removes/de-registers the callback and the window is no longer a drop target.

uisdk_RegisterRegInterceptCallback

  • Threading: foreground/immediate with intercept callback
  • Description: Registers registry interception item with redirection to the JS callback function
  • Function: uisdk_RegisterRegInterceptCallback(isCurrentUser, registryPath, registryValue, callback)
  • Arguments:
    • bool isCurrentUser - specify 'true' to watch the HKCU tree, and 'false' to watch the HKLM tree.
    • string registryPath - the registry path that should be intercepted
    • string registryValue - the value to be intercepted. If no value specified (null or empty) all values under the specified path are intercepted.
    • string callback - callback function name that is called each time the read-value request comes.
  • Returns:
    • "INVALID" if invalid parameters were passed, "ERROR" if any other error occurs.
    • "OK" if the registry interception is successfully installed for the specified registry path/value.
  • Callback: An object exposing the following properties:
    • string regPath - the registry path being read
    • int regValueName - the value name being read
  • Notes:
    • When an application reads from the specified registry path/value, the read request is delegated to the callback function.
    • The callback function should return the value which will be "read" instead of the actual value.
    • The value can be either string (REG_SZ) or integer (REG_DWORD) or array of bytes (REG_BINARY).
    • If null or an invalid data type is returned, the actual value stored in the registry will be returned to the application requesting the read.
    • To unregister the interception, call isdk_UnregisterRegIntercept with the same isCurrentUser, registryPath and registryValue arguments.

uisdk_RegisterRegInterceptValue

  • Description: Registers registry interception and returns a fixed value instead of the original value.
  • Threading: foreground/immediate
  • Function: uisdk_RegisterRegInterceptValue(isCurrentUser, registryPath, registryValue, value)
  • Arguments:
    • bool isCurrentUser - specify 'true' to watch the HKCU tree, and 'false' to watch the HKLM tree.
    • string registryPath - the registry path that should be intercepted
    • string registryValue (can be null) - the value under the registryPath that should be intercepted. In case no value specified (null or empty) - all values under the specified path are intercepted.
    • string value - the value that should be the result of the registry read request
  • Returns:
    • "INVALID" if invalid parameters were passed
    • "ERROR" if any other error occurs.
    • "OK" if the registry interception is successfully installed for the specified registry path/value.
  • Notes:
    • When an application reads from the specified registry path/value, the value passed in as an argument is returned instead of that stored in the registry.
    • The value can be either string (REG_SZ) or integer (REG_DWORD) or array of bytes (REG_BINARY). All other values are not supported.
    • To unregister the interception it's necessary to call the uisdk_UnregisterRegIntercept with the same isCurrentUser, registryPath and registryValue values.

uisdk_UnregisterRegIntercept

  • Description: Unregisters registry interception item
  • Threading: foreground/immediate
  • Function: uisdk_UnregisterRegIntercept(isCurrentUser, registryPath, registryValue)
    • bool isCurrentUser - specify 'true' to watch the HKCU tree, and 'false' to watch the HKLM tree.
    • string registryPath - the registry path that should be intercepted
    • string registryValue (can be null) - the value under the registryPath that should be intercepted. In case no value specified (null or empty) - all values under the specified path are intercepted.
  • Returns:
    • "INVALID" if invalid parameters were passed
    • "ERROR" if any other error occurs.
    • "OK" if the registry interception is successfully uninstalled.
  • Notes:
    • To register the interception use either the uisdk_RegisterRegInterceptCallback or uisdk_RegisterRegInterceptValue function.

uisdk_SafeDnsAddHost

  • Description: adds a SafeDNS entry to the internal table of Safe DNS hosts
  • Threading: foreground/immediate
  • Function: uisdk_SafeDnsAddHost(host, remapIps, checkPort)
  • Arguments:
    • string host - host address that should be remapped (can be prefixed with * as a wildcard)
    • array remapIps - an array of strings. each item in the array is the string - IP address to remap to
    • int checkPort (optional) - the service check port
  • Returns:
    • 'OK' if the SafeDNS entry is successfully added/set
    • 'INVALID' if invalid parameters were passed
    • 'ERROR' if any other error
  • Notes:
    • The function adds a new entry to the SafeDNS table (corresponds to a line from the hosts.ini file).
    • If the SafeDNS table already contains an entry for the specified host, that entry is overwritten with the given parameters (list of IPs and checkPort).
    • If more than one IP is mapped to a host, an IP will be chosen at random, providing a rudimentary load-balancing configuration.
    • If specified, the service check port will be used to determine service availabilty (TCP CONNECT) allowing multiple hosts to be set up in a HA configuration.
    • If a service check fails, another dns entry with the same host name will be chosen at random.
    • It is possible to configure SafeDNS such that only recognized IPs are used, and that attempts to load unregonized hosts can be routed to a catch-all IP.
    • SafeDNS can be configured programmatically, or the hosts.ini file can be embedded in the executable (the recommended option) before signing.

uisdk_SafeDnsRemoveHost

  • Description: removes a SafeDNS entry from the table of hosts.
  • Threading: foreground/immediate
  • Function: uisdk_SafeDnsRemoveHost(host)
  • Arguments:
    • string host - a valid local file name that should be appended with text
    • string textToAppend - host address that should be removed from the internal table of remaps
  • Returns:
    • 'OK' if the SafeDNS entry is found and removed,
    • 'ERROR' if this entry was not found
    • INVALID' if wrong parameter(s) passed.
  • Notes: None

uisdk_SafeDnsSetSetting

  • Description: changes the SafeDNS setting.
  • Threading: foreground/immediate
  • Function: uisdk_SafeDnsSetSetting(optionName, optionValue)
  • Arguments:
    • string optionName - the option that should be changed
    • string optionValue - the new value for the option
  • Returns:
    • 'OK' if the option was successfully changed.
    • 'ERROR' if there is no such option or the value for the option is invalid.
    • 'INVALID' if incorrect parameters were passed.
  • Notes:
    • Possible options are:
      • 'default', possible values for that option are:
      • 'allow': Allows an unrecognized dns request to pass the request to Windows.
      • 'block': Prevents a value from being return. (results in a NOT FOUND error).
    • address: A catch-all IP address.
    • int 'timeout': number of milliseconds before a TCP CONNECT against a service check port (see uisdk_SafeDnsAddHost) will fail.
    • string 'failover': a failover IP address to be used if all other DNS operations are unsuccessful.

uisdk_GetIpByHost

  • Description: Returns one or more IP addresses associated with the given host name (performs a DNS lookup)
  • Threading: background with callback.
  • Function: uisdk_GetIpByHost(host, callback)
  • Arguments:
    • string host - a valid internet host name (can be an IP address also)
    • string callback - specifies the callback function name. The function is called when the DNS lookup operation finishes
  • Returns:
    • "INVALID" if invalid parameters were passed
    • "ERROR" if any other error occurs.
    • Thread ID if successful.
  • Callback: On completion, an object with the following properties:
    • string func - the name of the function that initiated this callback (in that case it is equal to 'uisdk_GetIpByHost')
    • int threadId - the thread identifier
    • string status - the status of the start operation. Can be one of the following:
    • "DONE" - the operation completed successfully
    • "ERROR" - an internal error occured
    • string request - the requested item (in that case - the host name to resolve)
    • array response - an array of results, associating a number of IP address with the requested host.
  • Notes:
    • This function will be intercepted by SafeDNS or passed through to Windows, depending on the configuration.

Related

Wiki: Home