Delphi TMagRas Component
TMagRas Source Code v6
TMagRas Source Code v5
9th October 2018 - Sorry, you now need to request a free file download password to access Delphi components.
6th June 2017 - TMagRas v6.40 fixes
10 version 1703 bug that broke modem dialling with error 633 (port not
22nd March 2017 - TMagRas v5.73 supports Delphi 10.2 Tokyo with ANSI functions, TMagRas v6.33 supports Delphi 10.2 Tokyo with Unicode functions, both supporting Win32 and Win64 targets.
Delphi TMagRas Component is a set of installable Delphi non-visual components supplied with several demo and example programs and a help file, for accessing Dial Up Networking or Remote Access Services functions. It allows Delphi developers to add full RAS functionality to their applications, including dialling and monitoring multiple connections, creating and editing phonebooks (without using Windows dialogs), and getting performance information for connections. TMagRas supports Windows Vista, 2008, 7, 8, 2012, 10 and 2016.
TMagRas is supplied as five separate installable Delphi components: TMagRasCon includes dialling and monitoring and limited connection editing, TMagRasPer has performance statistics, TMagRasEdt to create and edit connections/ phonebooks, TMagTapi lists TAPI devices and monitors them (but does not make calls), and TMagRasAdm which supports the admin interface to RAS Server for incoming connections.
These are supported by MagRasApi that includes the prototypes for all RAS functions and loads them dynamically (in case RAS is not installed), MagTapiApi that includes prototypes for TAPI functions and loads them dynamically, WinPerf has NT performance data structures, MagRasPdhApi NT performance data helper, MagRasEnt to support phonebook entry lists, MagRasStr with RAS string literals, MagTapiStr with TAPI string literals, and MagSubs1 with common non-RAS functions.
A demo program illustrates use of the components, including monitoring multiple connections, creating a simple new connection with minimal properties, and editing detailed connection properties (seven tabs of settings) including Windows 2000 extensions. Seven example programs illustrate various aspects of the components and may be copied to quickly add specific RAS functionality to applications.
TMagRas is copyrighted software, but the compiled component DCUs may be used without charge in applications for use by the developer or within their company but which are not otherwise distributed (including freeware and shareware). The component source code may be licensed for a cost of £100 (UKP) (£120 with UK tax), which is about US$135 or 121 euro less tax. Developers that license the source may distribute applications using TMagRas. All existing source code licensees have access to TMagRas 5.73, but those that licensed it prior to January 2007 will need to pay a £50 (UKP) (£60 with UK tax) upgrade fee for access to TMagRas 6.3, the first time an upgrade was not free for nine years.
The TMagRas 5.73 compiled components are available without charge for Delphi 7, 2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6, XE7, XE8, 10 Seattle, 10.1 Berlin and 10.2 Tokyo. C++ is not supported. Earlier versions of the compiled component are available for Delphi 3, 4, 5 and 6.
RAS and Unicode
Windows NT4 and all later versions have supported Unicode internally, effectively two byte wide characters with the potential ability to display many thousands of symbols, including Greek, Russian and Far Eastern languages at the same time, provided the Windows OpenType font contains all the symbols. Unicode characters may be used in many places, file content, file names and paths, RAS entry names and logons, etc.
Although Windows itself supports Unicode, many applications are restricted to working in ANSI, which is one byte wide characters, so interaction with the Windows causes a translation to and from ANSI using the current code page. During conversion to ANSI, non-compatible Unicode characters may be substituted by a failed character which is usually ? and illegal in file names and paths. So ANSI only applications are unable to open files with non-compatible Unicode characters, and RAS entries will similarly fail.
Delphi 2007 and earlier primarily supported ANSI strings and Windows APIs. Although the widestring type was available, there was no wide TStrings for lists and sorting and the VCL was ANSI, so it was really only possible to support Unicode using third party component libraries.
Delphi 2009 and later fully support Unicode, with types String=UnicodeString and Char=WideChar, and the VCL handles Unicode fully. Beware updating earlier applications from earlier Delphi releases needs careful checking for all string and pointer usage, particularly PChar, Char, Chr, Move, SizeOf and FillChar whose behaviour may be effected by Unicode.
TMagRas 5.73 and earlier use the ANSI versions of the RAS APIs, which means entries can not be created with Unicode characters outside the current ANSI code page. Any entries created with such Unicode characters by other applications will be listed by TMagRas with failed characters (?) and will be unusable for calls to other RAS APIs. TMagRas 5.40 and later have been updated to support Delphi 2009 and later.
TMagRas 6.00 and later primarily support only Delphi 2009 and later, with full Unicode support by using the WideString versions of the RAS APIs and the UnicodeString type. TMagRas 6.00 will work with earlier versions of Delphi, but only with ANSI strings. All the TMagRas 6.00 widestring RAS units have W suffixes to keep them separate from the old units, but the component names are the same so only one version can be installed on toolbar at the time. To simplify the source code, support has been removed from TMagRas 6.00 for Windows 9.x and NT4, which are now 10 years old and rarely used, so TMagRas 5.60 should be retained if support for these is still needed. The main demo application is now RASDEMO6. TMagRas 6.00 and later are only available to source code licensees, no free compiled objects version is available.
Magenta TAPI Functions for Delphi
Magenta TAPI functions allow the monitoring of modems and ISDN adaptors using events. Once monitoring has commenced, when another Windows application starts dialling using the TAPI APIs, events are generated that allows the modem being used to be monitored. The actual events generated depend upon the TAPI Service Provider, may differ between Windows releases, between Win9x and NT, and between modems and ISDN adaptors. But they mostly follow the following sequence:
LINECALLSTATE_UNKNOWN - seems to indicate TAPI about to
An event handler returns the linecallstate, an ASCII version of it, and some extra information depending on the TAPI event. So when a call starts, the name of the application is provided, when it answers the modem connect speed is reported, when it's disconnected a reason may be available. An extra function is used to determine if there are any current calls when TAPI is started, causing an immediate event for each call. Once TAPI is initialised, details about each modem or ISDN adapter are available, including the serial port to which it is connected (except for some PnP modems) and it's registry key if further information is needed. By waiting for TAPI events, RAS monitoring programs can avoid continually polling using the RAS APIs. TAPI also monitors non-RAS modem usage and will monitor incoming calls. Currently, incoming calls can not be answered. At present, I've found no way of detecting the telephone number actually dialled by TAPI. If a RAS connection has been dialled, the RAS APIs can then be used to find the actual connection used, and then get the default telephone number. When using ISDN multilink, TAPI will provide separate events for each call, likewise if two modem calls are made simultaneously. So applications should allow for multiple calls, and check the which connections are defined to use which modems to determine what is going on.
Magenta TAPI Functions also includes routines to access the dialling properties dialog for each modem, telephony properties, and telephone number translation. So the canonical telephone number stored by DUN Connections (ie '+44 (0845) 047 5631') can converted into a displayable and dialable numbers according to telephony dialling properties, depending upon the current country and location, whether tone or pulse dialling is being used and whether a calling card is specified.
An application demonstrating the use of Magenta TAPI Functions is included with the RAS demo programs. The Delphi source code for Magenta TAPI Functions is supplied with the TMagRas source code and is not available separately.
Magenta Systems Ltd, 9 Vincent Road,
Croydon CR0 6ED, United Kingdom