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


C# (.NET) DLL Example

FOLDER: CSHARP\MYTSDLL

TYPE: Example integration in C# / .NET

SOURCE: INCLUDED

LANGUAGE: C# / .NET Framework

IDE: Visual Studio .NET 2003

MTS DLL with Source in C#

My-T-Soft Developer's Kit DLL - This is a reworked version of the MTSDLL written in C#, for inclusion with C# projects. For more details on the MTSDLL, see the original MTS DLL with Source.

Microsoft C# Version Notes

This was built in Microsoft Visual Studio.NET 2003, .Net Framework version 1.1 for maximum compatibility if you open the project in later versions of Visual Studio.NET, just say OK, etc. to convert to the current version you are running.

NOTE: The C# project cannot be run in older versions of Visual Studio.NET.

C# Developers:

Compiling the Dll code under Windows XP, Windows 2000 Professional

Prerequisites: .NET Framework version 1.1 or later.

a. You should find the folder CSHARP 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. 1. Navigate to .\CSHARP\MYTSDLL

b. Click on MYTSDLL.csproj to open the project

c. Click on Build->Build Solution from the menu to create the dll. The dll can be found in the .\CSHARP\MYTSDLL\bin\Release folder.

The DLL utilities comes with the following C# classes:

MYTSDriver.cs - main functionality for MTSDLL.DLL

Util.cs - utility class used for conversions.

Win32API.cs - contains the dllimport declarations needed to perform p/invoke statements between win32 api and the common language runtime

AssemblyInfo.cs - class used to control general information about the assembly Along with Project and solution files for Microsoft Visual Studio.NET:

MYTSDLL.csproj - Microsoft Visual Studio.NET C# project file

MYTSDLL.sln - Microsoft Visual Studio.NET solution object file

MYTSDLL.suo - Microsoft Visual Studio.NET Studio Solution User Options

MYTSDLL.csproj.user - Microsoft Visual Studio.NET Project User Options

MYTSDLLCS.DLL - compiled DLL that contains C# based functions called by the C# Application

Overview

These utilities were developed in response to customer suggestions, wants, needs, and by reviewing the capabilities of various high-end application development tools. The DLL approach allows use of these function calls directly by any environment capable of integrating a DLL. The inclusion of the source code allows easy integration into applications developed closer to the Windows API. The instructional information is also useful in allowing developers to create functional applications quickly.

There are various utilities. Some pair up as opposites, some are more powerful than others. Be sure to read through the following details to gain a good understanding of the ability of these tools to assist you in your development efforts. Please feel free to contact us with other ideas or needs.

See My-T-Soft Developer's Kit for additional info & examples, including how to enable seamless change-overs between configurations.

For usage examples of the C Dll version, please refer to the following: See the MS Access samples integrating the MTSDLL.DLL

Developer's Corner on website "http://www.imgpresents.com/imgdev.htm"

How To's in Developer's Corner

The Visual Basic Example (VBASIC folder in DevKit)

Note that Size 12 is a virtual barrier for re-sizing on the fly from the larger sizes (i.e. greater than size 12) to the smaller sizes (i.e. 12 or less). Do not cross this barrier one way or the other without first establishing a painted keyboard at size 12. The larger sizes are all keyed off of the dimensions of size 12, so corruption of the valid KBF file is possible (probable!) if crossing size 12!

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.

Utility Description / Function Call Interface

This is a list of each function in the DLL. See below for descriptions & interface:

GetXYMTS

GetXYWnd

MoveWindowMTS

SetCursorPosMTS

LaunchMTS

LaunchFromCurrentMTS

CloseMTS

MinimizeMTS

OpenMTS

SaveSettingsMTS

SavePositionMTS

RestoreSettingsMTS

RestorePositionMTS

ConfigureMTS

SendStringMTS

CopyConfigureMTS

ToggleConfigureMTS

SetInputWindowMTS

Utility Name: Get My-T-Soft Position (Top/Left, Width/Height, Bottom/Right)

Function name: GetXYMTS

vFunction Arguments: WhichType as long

//In MYTSDriver.cs

public const long TOPLEFT = 0x01;

public const long LEFTTOP = 0x01;

public const long BOTTOMRIGHT = 0x02;

public const long RIGHTBOTTOM = 0x02;

public const long WIDTHHEIGHT = 0x04;

Returns: long with low word as X, high word as Y

Example: GetXYMTS(TOPLEFT)

Description: This utility uses the GetWindowRect and returns an XY pair composed in a long

return value using the MAKELONG(x,y) macro.

Utility Name: Get Window Position (Top/Left, Width/Height, Bottom/Right)

Function name: GetXYWnd

Function Arguments: hWnd as IntPtr, WhichType as long

//In MYTSDriver.cs

public const long TOPLEFT = 0x01;

public const long LEFTTOP = 0x01;

public const long BOTTOMRIGHT = 0x02;

public const long RIGHTBOTTOM = 0x02;

public const long WIDTHHEIGHT = 0x04;

Returns: LONG with low word as X, high word as Y

Example: GetXYWnd(hWnd,TOPLEFT)

Description: This utility uses the GetWindowRect and returns an XY pair composed in a long return value using the MAKELONG(x,y) macro.

Utility Name: Launch My-T-Soft

Function name: LaunchMTS

Function Arguments: NONE

Returns: Nothing

Description: Executing this will execute the My-T-Soft Executable.

Notes: This assumes a standard install - for non-standard installs, see LaunchFromCurrentMTS.

Utility Name: Launch My-T-Soft from Current Path

Function name: LaunchFromCurrentMTS

Function Arguments: FileName path

Example: LaunchFromCurrentMTS("C:\TEMP\DEVELOP\")

Returns: Nothing

Description: Executing this will execute the My-T-Soft Executable.

Notes: This assumes the My-T-Soft files have been copied into the C:\TEMP\DEVELOP folder, and MYTSOFT.EXE & MYTSOFT.INI are included along with supporting DLL's, KBF's, KMF's, etc., etc. Locks in default INI location for other calls to DLL functions.

Utility Name: Close My-T-Soft

Function name: CloseMTS

Function Arguments: NONE

Returns: Nothing

Description: Executing this will close the My-T-Soft Executable.

Notes: Requested by an MS-Access Developer. Sends a WM_CLOSE message to the My-T-Soft Window.

Utility Name: Minimize My-T-Soft

Function name: MinimizeMTS

Function Arguments: NONE

Returns: Nothing

Description: Minimizes My-T-Soft using configured method.

Notes: Use OpenMTS to return My-T-Soft to original state.

Name: Open My-T-Soft

Function name: OpenMTS

Function Arguments: NONE

Returns: bool

Description: Opens My-T-Soft from minimized state using My-T-Soft API.

Notes: Opposite of MINMZMTS.EXE

Name: Move My-T-Soft Window

Function name: MoveWindowMTS

Function Arguments: X as int, Y as int

Returns: Nothing

Example: MoveWindow(200,20)

Description: Moves My-T-Soft window to indicated x & y position.

Notes: Extremely useful for complex applications. You may wish to always position My-T-Soft so the Tool bar panel (logo / menu / minimize) are mostly or all the way off the screen.

Name: SetCursor for My-T-Soft

Function name: SetCursorPosMTS

Function Arguments: X as int, Y as int

Example: SetCursorPos(200,20)

Returns: Nothing

Description: Moves cursor to indicated x & y position.

Notes: Focus issues and shell or exec implementation of My-T-Soft Utilities can sometimes result in the wrong window having the focus. By moving the cursor over My-T-Soft, code in My-T-Soft can resolve some focus issues.

Name: Configure My-T-Soft

Function name: ConfigureMTS

Function Arguments: /K[-] /E[-] /N[-] /C[-] /M[-] /W[-] /T[-] /B[-] /I[-] /Q[-] /G[-] /S:??

Returns: Nothing

Example: ConfigureMTS("/k-/e-/w/m/s:9")

Closes Keyboard & Edit panel, opens Windows Control & Macro Panel, sizes to 9.

K = Keyboard (alphanumeric) panel

E = Edit panel

N = Numeric panel

C = Calculator panel

M = Macro panel

W = Windows control panel

T = Tool / Control panel

B = Toolbar (3 icon panel)

G = Magnifier panel

I = System Info panel

Q = QuickHelp panel

- = after any of the above indicates the panel will be closed

S:?? = Size from 1 - 12

Description: Gives complete control over appearance. Used in conjunction with

MoveWindowMTS allows different looks / interfaces for complex applications.

Notes: This modifies the INI file, and then sends the update command to My-T-Soft. The UpdateDefINI routine is used to find installation folder and location of INI file.

Name: Copy and Configure My-T-Soft

Function name: CopyConfigureMTS

Function Arguments: [drive:][path]FileName

Example: CopyConfigureMTS("NUM.CFG"), CopyConfigureMTS("D:\PANELS\KEYPAD.CFG")

Returns: bool

Description: Gives complete control over appearance - cleaner switch over than ConfigureMTS.

Notes:

If no path is given within the FileName specification, the default My-T-Soft directory is used - however, for guaranteed operation, a well formed path (with short file names) is required.

The KEYBOARD.KBF file that is overwritten defaults to the default My-T-Soft directory.

Name: FindWindow & Control My-T-Soft

Function name: ToggleConfigureMTS

Function Arguments: [drive:][path]FileName

Example: ToggleConfigure("NUM.CFG,") ToggleConfigure("D:\PANELS\KEYPAD.CFG")

Returns: Nothing

Description: Gives complete control over appearance with the added ability to move the displayed panels off-screen if already on-screen. This is a modified version of CopyConfigureMTS that has the following logic: If My-T-Soft is visible, move it off-screen and do not process file. If My-T-Soft is not visible (off-screen), then process file.

Notes: This allows a toggle selection for the user using the same action (button on application, CTRLMTS buttons, etc.). Bring up the keyboard, then put it away. Note if My-T-Soft is off-screen, then this acts exactly as the CopyConfigureMTS utility. If My-T-Soft is visible, then its added feature of moving the software off-screen occurs. 1 monitor assumed (for multiple monitor configurations, modification of the source is probably required).

Name: Send String Through My-T-Soft

Function name: SendStringMTS

Function Arguments: Text String (with Build-A-Macro cooked format)

Returns: Nothing

Description: This communicates with My-T-Soft and hands off a text string to be processed and typed.

Notes: Version does not read the raw formats. Use the Save option in Build-A-Macro, Keystroke Macro, Zoom as the string format for this command. There is a file created (SDSTRMTS.KMF), and then the message is sent to My-T-Soft. The location is keyed off of the INI file, and must reside in the same folder as the executable.

Name: Save Position of My-T-Soft

Function name: SavePositionMTS

Function Arguments: NONE

Returns: Nothing

Description: Saves current position, for use with RestorePositionMTS, or upon re-opening of My-T-Soft.

Notes: Opposite of RestorePositionMTS. Same as Menu Option, Save Current Position.

Name: Save Settings of My-T-Soft

Function name: SaveSettingsMTS

Function Arguments: NONE

Returns: Nothing

Description: Saves current settings, for use with RestoreSettingsMTS, or upon re-opening of My-T-Soft.

Notes: Opposite of RestoreSettingsMTS. Same as Menu Option, Save Current settings.

Name: Restore Position of My-T-Soft

Function name: RestorePositionMTS

Function Arguments: NONE

Returns: Nothing

Description: Restore saved position.

Notes: Opposite of SavePositionMTS. Same as Menu Option, Restore Current Position.

Name: Restore Settings of My-T-Soft

Function name: RestoreSettingsMTS

Function Arguments: NONE

Returns: Nothing

Description: Restores saved settings.

Notes: Opposite of SaveSettingsMTS. Same as Menu Option, Restore Current settings.

Name: Interface to SetForegroundWindow API via MTSDLL

Function name: SetInputWindowMTS

Function Arguments: IntPtr to Window

Returns: bool result of SetForegroundWindow call

Description: Used to set the input focus (keyboard focus) to the specified window

Notes: There are various limitations in the various versions of Windows with this API and the ability for programs to control the input focus. This is just a basic interface in the DLL so an environment that doesnt have access to the Windows API can access SetForegroundWindow.

Refer to MSDN (Microsoft Developer Network) resources for limitations on this API call.

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


As seen in ...

Yahoo!finance