Most of the functions deal with extracting information about Windows and its current setup. This includes getting information about the logged in user, language and other formatting settings. There's a number of functions to read and write from the System Registry, INI files and from basic text files.
The FileReadArray
function is quite usefull to create reports that
are translatable: Add the label translations in separate text files, then use
the CurrentLanguage
to load the
appropriate text file. Finally create formula fields for each label to return
the indexed text from the string array.
Use the FileAppendLine
function to create a log file of who is
watching your report. And use the SysColor
to smoothly integrate the
Crystal Report ActiveX viewer inside your application, so your report colors
match the dialog/window of your app.
Note that the DateTimeToEpoch
is replacable with the native Crystal
function DateDiff("s", #1 Jan 1970#, Date1)
which is slightly
faster, but less readable. DateTimeToEpoch
and its friends
are highly needed if you store dates in your database as seconds since 1 Jan
1970 UTC or GMT.
The download contains an installation script for Crystal Reports 9. It can
easily be adapted to later versions. It's a simple JavaScript file that
copies the DLL file to the appropriate folder.
After installation, the new functions are available under the Additional
Functions item in the Function Tree, in the module named Win32.
Interface
Name | Description | |
---|---|---|
![]() | DateTimeToUtc | Adjusts a local DateTime to UTC. |
![]() | UtcToDateTime | Adjusts a DateTime value in UTC to local time. |
![]() | DateTimeToEpoch | Converts a DateTime value to an Epoch date (known as "Unix time"; or the time_t structure). Expects local time and returns UTC number. |
![]() | EpochToDateTime | Converts an Epoch date to a DateTime value. Returns a local time DateTime value. |
![]() | TimezoneBias | Returns the current UTC timezone difference in minutes (daylight saving). |
![]() | SysColor | Returns a Windows System color. Use Windows native constants such as "COLOR_WINDOW" to specify what information to extract. |
![]() | ReadIniValue | Reads a string from a Windows INI file. |
![]() | WriteIniValue | Writes a string to a Windows INI file. |
![]() | ReadRegistryValue | Reads data from the registry. Both String and Integer values are read, but a string type is always returned. |
![]() | WriteRegistryValue | Writes a string to the registry. |
![]() | WindowsDir | Returns the path where Windows is installed. |
![]() | SystemDir | Returns the Windows System path. |
![]() | AppDir | Returns the path where the viewer is installed. When run from the Crystal Reports Designer this is the location of CR.EXE . |
![]() | LoginName | Returns the login name of the current user. |
![]() | ComputerName | Returns the Computer name. |
![]() | RegisteredUserName | Returns the name of the registered user. |
![]() | RegisteredCompany | Returns the company name of the registered user. |
![]() | CurrentDir | Returns the current directory. |
![]() | CurrentLanguage | Returns the current language identifier (abbreviated name of the language based on the ISO Standard 639). |
![]() | CurrentCodePage | Returns the active CodePage. |
![]() | PrintDebugOutput | Sends a string to the Windows debug stream (Win32 OutputDebugString() function) |
![]() | DriveSerial | Returns the serial number of a disk drive/volume. |
![]() | FileDelete | Deletes a file. Pass a complete filename to the function. |
![]() | FileExists | Returns whether the file exists or not. |
![]() | FileAppendLine | Appends a line to a file. A newline character is automatically added. |
![]() | FileReadArray | Reads a file as an array of strings. |
![]() | FormatArgs | Formats a string with tokens, such as "Insert $1 here". Second argument is an array of strings which contains the replacement tokens. |
![]() | LocaleInfo | Returns Windows locale (country) information. Use Windows native constants such as "LOCALE_SCURRENCY" to specify what information to extract. |
![]() | SystemMetrics | Returns Windows System Metrics, such as screen size. Use Windows native constants such as "SM_CXFULLSCREEN" to specify what information to extract. |
![]() | WindowsVersion | Returns the Windows version as a decimal number (eg. 4.0 for Windows NT 4) |
![]() | ShellExecute | Launches an external application. |
![]() | PlaySound | Plays a wave (.wav) file. Use an empty filename to stop playing. |
![]() | SetClipboardText | Assigns text to the clipboard. |
![]() | AnsiToOem | Convert from ANSI charset to OEM. |
![]() | OemToAnsi | Convert from OEM charset to ANSI. |
![]() | BAND | Binary AND. |
![]() | BOR | Binary OR. |
![]() | BXOR | Binary XOR. |
Source Code Dependencies
Microsoft Visual C++ 6.0Crystal Reports 9.0 (Dev.Ed)
Download Files 
![]() | Installation and sample (48 Kb) Source Code (15 Kb) |