View on GitHub

Sirius

Sirius Server Win32 Overview

Download this project as a .zip file Download this project as a tar.gz file

Introduction

Sirius Server Win32 module contains functionality manipulating with Win32 objects. From the server side it’s wrapper on Win32 API via JNA library.

Consists of classes dedicated to:

Project Documentation

ResourceDescription
Project Documentation Home PageThe home page for generated Maven site containing major technical documentation for the module
Project Reports PageThe home page for generated Maven site containing major analysis reports for the module
Project Javadoc PageThe home page for generated Maven site containing major Javadoc documentation for the module

Endpoints

Each of those classes is represented with dedicated endpoint. Currently the following endpoints are included:

EndpointClassDescription
http://<base URL>/win32/utilsorg.sirius.server.win32.Win32UtilsWin32 utility functionality usually wrapper on some callback functions which can not be used via service communication
http://<base URL>/win32/windoworg.sirius.server.win32.classes.WindowGeneral operations applicable to mupliple window classes
http://<base URL>/win32/menuorg.sirius.server.win32.classes.MenuMenu-specific operations
http://<base URL>/win32/dialogorg.sirius.server.win32.classes.DialogDialog-specific operations
http://<base URL>/win32/buttonorg.sirius.server.win32.classes.controls.ButtonOperations specific to the button window class
http://<base URL>/win32/comoboxorg.sirius.server.win32.classes.controls.ComboBoxCombo box specific operations
http://<base URL>/win32/editorg.sirius.server.win32.classes.controls.EditText field specific operations
http://<base URL>/win32/listboxorg.sirius.server.win32.classes.controls.ListBoxList box specific operations
http://<base URL>/win32/tabcontrolorg.sirius.server.win32.classes.controls.TabControlTab control specific operations

Dependencies

This component depends on Win32 Lib service and contains endpoints to interact with Win32 Lib.

Installation

Add instructions

Usage

This component contains the server side functionality and it is used to extend existing server side API.

All the methods are designed to be independent and in most cases they use some specific window handle. So, in order to interact with some specific window we should go through the following steps:

Identify search criteria for the window

Search criteria is identified by Win32Locator data type. For Win32 component the following fields are used:

The below example shows how to initialize search criteria:

1
2
Win32Locator locator = new Win32Locator();
locator.setCaption("Common Controls Examples");

Here we look for the main window with the Common Controls Examples caption. All other fields set into the default values indicating that we are looking for the first window with that caption for any window class and starting from the top level window.

Search for window based on search criteria

Once we defined search criteria we can use it to get the handle of the window we want to interact with. Main class for locating windows is Win32Utils. In most cases we have to look for windows within objects hierarchy. So, we mostly need searchWindow method for that. See the example below:

1
2
Win32Utils utils = new Win32Utils();
long hwnd = utils.searchWindow(locator);

In some cases we have to look for dialog boxes which are not really siblings of the main window but they are kept as the separate structure within the same process. To look for the windows like that we should use searchSameThreadWindow method. E.g.:

1
2
3
Win32Locator locator = new Win32Locator();
locator.setWinClass("#32770");
long hwnd = utils.searchSameThreadWindow(hwnd,locator);

In this case the search will be performed in the same thread where the hwnd is stored.

Call some function interacting with the window

Once we have the window handle we can call the Server API functions to interact with the window. E.g.:

1
2
Window win = new Window();
win.activate(hwnd);

Links

Authors

Myk Kolisnyk (kolesnik.nickolay@gmail.com)

View Mykola Kolisnyk's profile on LinkedIn

Google+