IMG Home PageIMG ProductsProduct DownloadsOrdering InformationTechnical Support and Frequently Asked QuestionsDeveloper's Corner and UtilitiesAbout IMG
CustomersIMG ResellersMedia InformationIMG Events / Trade ShowsUseful LinksIMG Contact InformationIMG Information / Policies
Translate




Java Example

FOLDER: JAVA

TYPE: Example integration in Java

SOURCE: INCLUDED

LANGUAGE: Java

IDE: Eclipse 3.00

Welcome to the Java Example set for Developers!

Java Examples / DLL of DevKit. This is an add-on to the Developer's Kit for IMG's My-T-Soft to allow Java Developer's to access & Use the Developer's Kit directly from Java.

Java Version Notes

This was built in Eclipse 3.0, java version 1.4.2_08.

NOTE: jre version 1.4 or later is needed to run code from Eclipse 3.0.

Files & Notes

JNIMTSDLL.dll - Dll that interfaces with My-T-Soft

MTSDIR.dll - finds the My-T-Soft installation path

MYTSOFT.java - the main java application.

swt-win32-3064.dll - dll used for swt gui applications.

Running the application under Windows XP, Windows 2000 Professional

Prerequisites: J2RE version 1.4.2_08 or later.

J2SDK version 1.4.2_08 or later (needed to create C++ header files for jni).

Update the environment variable Path to include the bin folder of both the J2RE and J2SDK.

Eclipse 3.0

a. You should find the folder JAVA in default install location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen). If folder is not found then follow the installations instructions under Sec. 3. Navigate to .\JAVA\MYTSOFT\exec

b. Click on MYTSOFT.jar to run the application

Running the code under Windows XP, Windows 2000 Professional

Prerequisites: J2RE version 1.4.2_08 or later.

J2SDK version 1.4.2_08 or later (needed to create C++ header files for jni).

Eclipse 3.0

Note: Update the environment variable Path to include the bin folder of both the J2RE and J2SDK.

a. You should find the folder JAVA in default install location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen). If folder is not found then follow the installations instructions under Sec. 3. Navigate to .\JAVA

b. Open Eclipse.

c. Copy the MYTSOFT folder from .\JAVA to the Eclipse workspace

i.e. C:\eclipse\workspace

d. In Eclipse, click on Window->Open Perspective->Java

e. In the Package Panel on the left side, right click in the white space and click on Import... from the menu. In the Import Dialog box click on Existing Project into Workspace and click Next

f. Click Browse and choose the MYTSOFT folder that was copied to the eclipse workspace directory

g. Click OK

h. Click Finish

i. In the Package Panel expand (default package) to open the Java file.

j. To Run the application, click Run->Run As->Java Application.

Compiling the MTSDll Dll code under Windows XP, Windows 2000 Professional

Prerequisites: J2RE version 1.4.2_08 or later.

J2SDK version 1.4.2_08 or later (needed to create C++ header files for jni).

Microsoft Visual C++ 6.0

a. You should find the folder JAVA in default install location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen). If folder is not found then follow the installations instructions under Sec. 3.

b. Open Microsoft Visual C++ 6.0

c. Click File->Open Workspace and navigate to the location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen) then to folder Java\MTSDLL and click on the file MTSDLL.dsw

d. To compile the code click Build->Build JNIMTSDLL.dll.

The dll can be found in the .\JAVA\MTSDLL\Release folder.

Note: jni_md.h, jni.h must be copied from the j2sdk 1.4 (or later) folder and pasted in the Visual Studio Include folder i.e "%installed path%\Microsoft Visual Studio\VC98\Include".

Compiling the MTSDIR Dll code under Windows XP, Windows 2000 Professional

Prerequisites: J2RE version 1.4.2_08 or later.

J2SDK version 1.4.2_08 or later (needed to create C++ header files for jni).

Microsoft Visual C++ 6.0

a. You should find the folder JAVA in default install location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen). If folder is not found then follow the installations instructions under Sec. 3.

b. Open Microsoft Visual C++ 6.0

c. Click File->Open Workspace and navigate to the location of the My-T-Soft product (My-T-Soft, My-T-Touch, My-T-Pen) then to folder Java\MTSDIR and click on the file MTSDIR.dsw

d. To compile the code click Build->Build MTSDIR.dll.

The dll can be found in the .\JAVA\MTSDIR\Debug folder.

Some of the features assume that the Developer's Kit has already been "installed". If the "Send Text Thru" or the "External Control" examples are not operating properly, then install the DevKit:

Start Menu | Programs | My-T-???? | Install Developer's Kit

Notes on the two dll's used in this project

NOTE:

MTSDIR Folder contains the dll that is used obtains the directory where the My-T-Soft product was installed.

MTSDLL Folder contains the dll utilities themselves

NOTE: jni_md.h, jni.h must be copied from the j2sdk 1.4 (or later) folder and pasted in the Visual Studio Include folder i.e "%installed path%\Microsoft Visual Studio\VC98\Include".

**********************************************************

DISCLAIMER

The source code & derived executable are provided at no cost as useful & instructional materials to developers & system integrators incorporating IMG software. Because no licensing fee has been tendered, there is no technical support offered for this software, source code, or its capabilities to solve a particular problem.

**********************************************************

There is a fair amount of error checking, but every possibility has not been addressed. If the default installation of all components has been done, then the operation should be straightforward & error free. If there are operational problems, then it is assumed that as a JAVA developer, fixing the error will not be a problem. You may contact IMG at "devkit@imgpresents.com" or check our website "http://www.imgpresents.com" for any news or updates, but technical support is not offered for the Developer's Kit utilities - source code is provided, and should be referenced.

Once workspace is setup in Elcipse, simply click Run, Run As then click Java Application from the menu to engage the form & start Operation. Click on buttons to see operational features, "Stop" operation and review SWT Properties / Controls & Class code, etc. See MTDLL.dsw for the source code of C based DLL.

Note - the MTSDLLJNI DLL has been modified to implement the Java Native Interface (JNI) to allow interoperablity between Java and C.

Operation Notes

Load Event

If the MTSDLL.DLL is not found in the current directory or in the application path where MT??, is installed, a InputBox will appear to "ask" for its location, enter the full path including the filname into the textbox and hit Enter.

Buttons / Text Fields

Launch - This will launch the appropriate product based on the project loaded. By default (See DLL Source code) My-T-Soft is attempted, if it fails, then My-T-Touch is attempted, if it fails, then My-T-Pen is attempted. If these fail, then it is assumed the default install locations have not been used, and the LaunchFromCurrentMTS function is called with the current directory, and the parent folder (i.e. the folder that contains the CSHARP folder) is used as the location of the product. If the My-T-Soft keyboard is NOT launched, either:

a) Modify the source code to fit your requirements

-or-

b) Run the My-T-Soft product directly...

Close - this will Close the running keyboard software

Minimize to Button - will send the message to minimize to button

Open from Button - will send the message to open from the button state

MoveWindow / text fields X & Y - enter appropriate values in the text fields, and click on button to move keyboard window to that (Top/Left) X, Y location

Set Cursor Position / text fields X & Y - this will move the cursor (mouse cursor) to X, Y location

Save Settings - Saves the current configuration / panels open on the keyboard software

Save Position - Saves the Top/Left X, Y position of the keyboard software

Restore Settings - restores the saved panels & position

Restore Position - restores X, Y location (Top/Left) of keyboard software with current configuration preserved

Send Text Through My-T-Soft - This is an advanced feature of the My-T-Soft version - the Java example does not back support My-T-Touch or My-T-Pen, although this could work with some modification - this is left as an exercise for the developer. The compatibility issue revolves around the way the keystrokes are sent - the example here uses the embedded codes ([Tab], [Enter], [F1]), and this is only supported in the SDSTRM32.EXE, which only operates with My-T-Soft Version 1.50 and above (or NT/2000 versions).

This is grayed out in the My-T-Touch and My-T-Pen versions (Enabled = False) earlier than 1.70. In order to operate properly, the Developer's Kit must have been installed (to ensure the SDSTRM32.EXE file is in the Install directory). By clicking on the Send button, the text in the left-hand text field will be sent through to My-T-Soft - the default [Tab] moves the keyboard focus to the right text field, and the rest of the text is typed. In order for My-T-Soft to type via this mechanism, the cursor must have previously been over the keyboard window, or must be moved over the keyboard window to "engage" the appropriate window & keyboard focus code in My-T-Soft. See Developer notes / source code for SDSTRMTS for other details. Note that using the Set Cursor Position option, this can be forced with a FindWindow / GetWindowRect with the Windows API or MoveWindowMTS and SetCursorPosMTS.

Configuration On-the-fly - Select the appropriate panels and/or size, click on Configure and the keyboard software will reconfigure itself based on the checked panels / size. Note that the position is dependent on current position, and how the new configuration will fit on screen.

See External Control & notes on CPYCNMTS.C for a much stronger level of control which includes positioning.

External Control - For proper operation, the Developer's Kit MUST be extracted (installed). The files KYBD.CFG, EDIT.CFG, NUM.CFG, and MACRO.CFG must be in the installation directory. If you want to modify the default "configurations", refer to the notes of CPYCNMTS (Copy & Configure My-T-Soft) in the Developer's Kit. Essentially, the configuration & position must be saved - Save Position / Save Settings. Then the KEYBOARD.KBF can be copied to the "saved" configuration (e.g. COPY KEYBOARD.KBF NEW.CFG). Call 'CopyConfigureMTS("NEW.CFG")' to establish this configuration instantly...

Keyboard Config - Uses KYBD.CFG

Edit Config - Uses EDIT.CFG

Num Config - Uses NUM.CFG

Macro Config - Uses MACRO.CFG

Toggle off-screen or reconfigure - this uses the FWCTLMTS approach. Logic is: if "on-screen", move "off-screen" if "off-screen" used CopyConfigure approach to establish new configuration.

My-T-Soft Java Examples

Version 1.78 - August 9, 2005

Copyright 2004-2005 by Innovation Management Group, Inc. All Rights Reserved.

My-T-Mouse, My-T-Pen, My-T-Touch, and My-T-Soft are registered trademarks of Innovation Management Group, Inc.


IMG Home PageIMG ProductsProduct DownloadsOrdering InformationTechnical Support and Frequently Asked QuestionsDeveloper's Corner and UtilitiesAbout IMG
CustomersIMG ResellersMedia InformationIMG Events / Trade ShowsUseful LinksIMG Contact InformationIMG Information / Policies