MoneyTalks for Delphi

Version 2.0 (32 bit)
(C) Copyright by Cam Hyde
All Rights Reserved
cam_hyde@clear.net.nz
July 1997

Table of Contents

1. Introduction
2. Registration and Copyright
3. Installation
4. Demonstration Program
5. Function reference

Introduction
MoneyTalks for Delphi includes Delphi Compiled Unit (DCU) containing:

1. a function which converts currency values from $0.00 to $1,700,000,000.00 to a string describing the amount in words.  Useful for applications that need to print cheques, bank authority forms, or other financial documents where the amount in words is required in addition to the amount in digits.
2. a function which takes the same parameters as the MessageDlg function, but also plays the sound set in the Windows Control Panel corresponding to the TMsgDlgType parameter (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom).

Registration and Copyright
MoneyTalks is available as shareware for a registration fee of US$10, and can be registered via the Shareware forum on CompuServe (GO SWREG) ID 15347.

Registered users will receive the MoneyTalks.DCU file containing the functions employed in the demonstration program, and will be entitled to royalty free use and distribution of the MoneyTalks function in their own programs.

Technical support can be obtained by e-mailing the author at cam_hyde@clear.net.nz.

Installation
When you register MoneyTalks, you will receive a WinZIP file containing MoneyTalks.DCU.  Extract the MoneyTalks.DCU file to the Delphi 2.0 library file (...Delphi 2.0\Lib).

Demonstration Program
MoneyTalks.Exe allows you to enter a numeric value (don't enter dollar signs or commas) and displays:

1. the corresponding amount in numbers formatted with currency symbols (standard Delphi Format('%m', [...]) stuff); and
2.  the corresponding amount in words (the tricky part).

MoneyTalks.Exe allows you to press one of the buttons and:

1. plays the sound set in the Windows Control Panel corresponding to the button pressed; and
2. displays a message dialog with the appropriate message type, and the name of the Windows Control Panel sound.

Function Reference
CurrencyToWords

Unit
MoneyTalks

Declaration
function CurrencyToWords(const Amount: Currency): String;

Description
CurrencyToWords converts the currency value (up to $1,700,000,000.00) given by Amount to a string containing its representation in English.

If Amount contains a zero value, a blank string is returned.  If Amount is a whole number, the returned string does not include a definition of the cents (e.g. $100.00 returns "One Hundred Dollars").  If Amount is less than $1.00, the returned string does not include a definition of the dollars (e.g. $0.15 returns "Fifteen Cents").  If the dollars or cents portion of Amount equals one, the returned string contains the singular form of the denomination (e.g. $1.01 returns "One Dollar and One Cent").  Billions are based on the U.S. definition, that being $1,000,000,000.00.

Example
The following example sets ChequeAmountInWords to "One Hundred and Twenty-Three Dollars and Forty-Five Cents".

const
  ChequeAmount: Currency = 123.45;
var
  ChequeAmountInWords: String;
begin
  ChequeAmountInWords := CurrencyToWords(ChequeAmount);
  ...
end;
  
Function Reference
sndMessageDlg

Declaration
function	sndMessageDlg(const Msg: string; AType: TMsgDlgType; AButtons: TMsgDlgButtons; HelpCtx: LongInt): Word;

Description
sndMessageDlg plays the sound set in the Windows Control Panel corresponding to the TMsgDlgType parameter.

If TMsgDlgType is set to:

1. mtWarning, the Exclamation sound is played;
2. mtError, the Critical stop sound is played;
3. mtInformation, the Default sound is played;
4. mtConfirmation, the Question sound is played;
5. mtCustom, no sound is played.

