ViaThinkSoft Currency Converter - DLL specification
Table of Contents
These methods are exported by CurConv.dll:
DeleteAPIKey
Syntax
Delphi
function DeleteAPIKey(Mode: TVtsCurConvKeyStoreMode; DontShowErrors: BOOL): HRESULT; stdcall;
C
HRESULT __stdcall DeleteAPIKey(CURCONV_STORE_MODE Mode, BOOL DontShowErrors);
Description
Deletes the API key from the registry.
Parameters
- Mode:
- CONVERT_KEYSTORE_REGISTRY_SYSTEM (0) = The API key will be deleted from
HKEY_LOCAL_USER
.
- CONVERT_KEYSTORE_REGISTRY_SYSTEM (1) = The API key will be deleted from
HKEY_LOCAL_MACHINE
.
- CONVERT_KEYSTORE_MEMORY (2) = The API key will be deleted from temporary memory.
- DontShowErrors: If true, no errors will be displayed, otherwise, errors will result in a dialog box, in addition to the result code.
Returns
- S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.
- S_VTSCONV_NOTHING (0x20000001) if no key could be found.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.
WriteAPIKey
Syntax
Delphi
function WriteAPIKey(key: LPCTSTR; Mode: TVtsCurConvKeyStoreMode; DontShowErrors: BOOL): HRESULT; stdcall;
function WriteAPIKeyW(key: LPCWSTR; Mode: TVtsCurConvKeyStoreMode; DontShowErrors: BOOL): HRESULT; stdcall;
function WriteAPIKeyA(key: LPCSTR; Mode: TVtsCurConvKeyStoreMode; DontShowErrors: BOOL): HRESULT; stdcall;
C
HRESULT __stdcall WriteAPIKeyW(LPCWSTR key, CURCONV_STORE_MODE Mode, BOOL DontShowErrors);
HRESULT __stdcall WriteAPIKeyA(LPCSTR key, CURCONV_STORE_MODE Mode, BOOL DontShowErrors);
Description
Writes the API key into the registry. This is usually not necessary, since the Convert() method is able to query the key from the user using the GUI.
Parameters
- key: The 32 digit key you received from currencylayer.com
- Mode:
- CONVERT_KEYSTORE_REGISTRY_SYSTEM (0) = The API key will be written to
HKEY_LOCAL_USER
.
- CONVERT_KEYSTORE_REGISTRY_SYSTEM (1) = The API key will be written to
HKEY_LOCAL_MACHINE
.
- CONVERT_KEYSTORE_MEMORY (2) = The API key will be written to temporary memory.
- DontShowErrors: If true, no errors will be displayed. If true, errors will result in a dialog box, in addition to the result code.
Returns
- S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured, e.g. if the registry is write protected.
- E_VTSCONV_BAD_ARGS (0xA0000001) if the key is invalid.
ReadAPIKey
Syntax
Delphi
function ReadAPIKey(key: LPTSTR; DontShowErrors: BOOL): HRESULT; stdcall;
function ReadAPIKeyW(key: LPWSTR; DontShowErrors: BOOL): HRESULT; stdcall;
function ReadAPIKeyA(key: LPSTR; DontShowErrors: BOOL): HRESULT; stdcall;
C
HRESULT __stdcall ReadAPIKeyW(LPWSTR key, BOOL DontShowErrors);
HRESULT __stdcall ReadAPIKeyA(LPSTR key, BOOL DontShowErrors);
Description
Reads the API key from the registry.
Parameters
- key: A buffer where the 32 digit key will be written to. There should be at least 33 chars memory reserved (32 chars key + 1 char zero termination).
- DontShowErrors: If true, no errors will be displayed. If true, errors will result in a dialog box, in addition to the result code.
Returns
- S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured, e.g. if the registry is write protected.
- E_VTSCONV_STOREDKEY_INVALID (0xA0000002) if the key stored in the registry is invalid.
- E_VTSCONV_NO_STOREDKEY (0xA0000003) if there is no key stored in the registry.
ConvertEx
Syntax
Delphi
function Convert(Value: Double; CurFrom, CurTo: LPCTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall; deprecated;
function ConvertW(Value: Double; CurFrom, CurTo: LPCWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall; deprecated;
function ConvertA(Value: Double; CurFrom, CurTo: LPCSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall; deprecated;
function ConvertEx(Value: Double; CurFrom, CurTo: LPCTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutValue: PDouble; OutTimestamp: PDateTime): HRESULT; stdcall;
function ConvertExW(Value: Double; CurFrom, CurTo: LPCWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutValue: PDouble; OutTimestamp: PDateTime): HRESULT; stdcall;
function ConvertExA(Value: Double; CurFrom, CurTo: LPCSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutValue: PDouble; OutTimestamp: PDateTime): HRESULT; stdcall;
C
double __stdcall ConvertW(double Value, LPCWSTR CurFrom, LPCWSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate); // deprecated
double __stdcall ConvertA(double Value, LPCSTR CurFrom, LPCSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate); // deprecated
HRESULT __stdcall ConvertExW(double Value, LPCWSTR CurFrom, LPCWSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate, double* OutValue, DATE* OutTimestamp);
HRESULT __stdcall ConvertExA(double Value, LPCSTR CurFrom, LPCSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate, double* OutValue, DATE* OutTimestamp);
Description
Converts into a differnt currency.
Parameters
- Value: The amount of money in the source currency you want to convert into the target currency.
- CurFrom: The source currency, formatted as defined in ISO-4217 (3 chars, e.g. "USD")
- CurTo: The target currency, formatted as defined in ISO-4217 (3 chars, e.g. "USD")
- MaxAge: Defines, after which amount of time the exchange data needs to be re-downloaded from the server.
- -1: Only download once
- 0: Always download, on each request (attention: API keys may have limited amount of accesses per month)
- >0: Download after the supplied amount of time (in seconds)
- Flags: Is a sum of following components:
- CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.
- CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.
- CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.
- CONVERT_NO_INTERACTIVE_API_KEY_INPUT (16): Don't ask the user for an API key in case the API key is missing or invalid.
- HistoricDate:
- 0: Use the current exchange data
- any valid DATE: use an historic exchange
- OutValue: The amount of money in the target currency.
- OutTimestamp: Returns the timestamp of the data in the current system timezone.
Returns
- S_VTSCONV_OK (0x20000000) if the download was successful.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.
AcceptedCurrenciesEx
Syntax
Delphi
function AcceptedCurrencies(WriteTo: LPTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall; depreacted;
function AcceptedCurrenciesW(WriteTo: LPWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall; depreacted;
function AcceptedCurrenciesA(WriteTo: LPSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall; depreacted;
function AcceptedCurrenciesEx(WriteTo: LPTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutElements: PInteger): HRESULT; stdcall;
function AcceptedCurrenciesExW(WriteTo: LPWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutElements: PInteger): HRESULT; stdcall;
function AcceptedCurrenciesExA(WriteTo: LPSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate; OutElements: PInteger): HRESULT; stdcall;
C
int __stdcall AcceptedCurrenciesW(LPWSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate); // deprecated
int __stdcall AcceptedCurrenciesA(LPSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate); // deprecated
HRESULT __stdcall AcceptedCurrenciesExW(LPWSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate, int* OutElements);
HRESULT __stdcall AcceptedCurrenciesExA(LPSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate, int* OutElements);
Description
Shows a list of available currencies.
Parameters
- WriteTo: A pointer to which the available currencies will be written to. Please reserve at least (NumOfCurrencies*3+1) characters of memory. To query how many currencies are available, please invoke the method once and set this parameter to NULL. All currencies will be appended in the format as defined in ISO-4217. Example: "USDEURCAD\0" will be a list of USD, EUR and CAD.
- MaxAge: Defines, after which amount of time the exchange data needs to be re-downloaded from the server.
- -1: Only download once
- 0: Always download, on each request (attention: API keys may have limited amount of accesses per month)
- >0: Download after the supplied amount of time (in seconds)
- Flags: Is a sum of following components:
- CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.
- CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.
- CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.
- CONVERT_NO_INTERACTIVE_API_KEY_INPUT (16): Don't ask the user for an API key in case the API key is missing or invalid.
- HistoricDate:
- 0: Use the current exchange data
- any valid DATE: use an historic exchange
- OutElements: Returns the number of currencies found/written
Returns
- S_VTSCONV_OK (0x20000000) if the download was successful.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.
DownloadNow
Syntax
Delphi
function DownloadNow(Flags: TVtsCurConvFlags; HistoricDate: TDate): HRESULT; stdcall;
C
HRESULT __stdcall DownloadNow(CURCONV_FLAGS Flags, DATE HistoricDate);
Description
Forces the framework to download the currency table.
Parameters
- Flags: Is a sum of following components:
- CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.
- CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.
- CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.
- CONVERT_NO_INTERACTIVE_API_KEY_INPUT (16): Don't ask the user for an API key in case the API key is missing or invalid.
- HistoricDate:
- 0: Use the current exchange data
- any valid DATE: use an historic exchange
Returns
- S_VTSCONV_OK (0x20000000) if the download was successful.
- E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.
Last change: 8 September 2024