Subversion Repositories currency_converter

Rev

Rev 13 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11 daniel-mar 1
<!DOCTYPE html>
2
<html>
3
 
4
<head>
5
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
        <title>ViaThinkSoft Currency Converter - DLL specification</title>
7
        <style type="text/css">
8
                pre { white-space: pre-wrap !important; }
9
                body { font-family:system, -apple-system, ".SFNSText-Regular", "San Francisco", "Oxygen", "Ubuntu", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif; }
10
        </style>
11
</head>
12
 
13
<body>
14
 
15
<h1>ViaThinkSoft Currency Converter - DLL specification</h1>
16
 
17
<h2>Table of Contents</h2>
18
 
19
<p>These methods are exported by <b>CurConv.dll</b>:</p>
20
 
21
<ul>
22
        <li><a href="#DeleteAPIKey">DeleteAPIKey</a></li>
23
        <li><a href="#WriteAPIKey">WriteAPIKey</a></li>
24
        <li><a href="#ReadAPIKey">ReadAPIKey</a></li>
25
        <li><a href="#Convert">Convert</a></li>
26
        <li><a href="#AcceptedCurrencies">AcceptedCurrencies</a></li>
27
        <li><a href="#DownloadNow">DownloadNow</a></li>
28
</ul>
29
 
30
<h2 id="DeleteAPIKey">DeleteAPIKey</h2>
31
 
32
<h3>Syntax</h3>
33
<h4>Delphi</h4>
34
<pre>function DeleteAPIKey(UserMode: BOOL; DontShowErrors: BOOL): HRESULT; stdcall;
35
</pre>
36
<h4>C</h4>
37
<pre>HRESULT __stdcall DeleteAPIKey(BOOL UserMode, BOOL DontShowErrors);
38
</pre>
39
 
40
<h3>Description</h3>
41
<p>Deletes the API key from the registry.</p>
42
 
43
<h3>Parameters</h3>
44
<ul>
45
        <li>UserMode: If true, the API key will be deleted from <code>HKEY_LOCAL_USER</code>, otherwise it will be deleted on <code>HKEY_LOCAL_MACHINE</code>.</li>
46
        <li>DontShowErrors: If true, no errors will be displayed, otherwise, errors will result in a dialog box, in addition to the result code.</li>
47
</ul>
48
 
49
<h3>Returns</h3>
50
<ul>
51
        <li>S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.</li>
52
        <li>S_VTSCONV_NOTHING (0x20000001) if no key could be found.</li>
53
        <li>E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.</li>
54
</ul>
55
 
56
<h2 id="WriteAPIKey">WriteAPIKey</h2>
57
 
58
<h3>Syntax</h3>
59
<h4>Delphi</h4>
60
<pre>function WriteAPIKey(key: LPCTSTR; UserMode: BOOL; DontShowErrors: BOOL): HRESULT; stdcall;
61
function WriteAPIKeyW(key: LPCWSTR; UserMode: BOOL; DontShowErrors: BOOL): HRESULT; stdcall;
62
function WriteAPIKeyA(key: LPCSTR; UserMode: BOOL; DontShowErrors: BOOL): HRESULT; stdcall;
63
</pre>
64
<h4>C</h4>
65
<pre>HRESULT __stdcall WriteAPIKeyW(LPCWSTR key, BOOL UserMode, BOOL DontShowErrors);
66
HRESULT __stdcall WriteAPIKeyA(LPCSTR key, BOOL UserMode, BOOL DontShowErrors);
67
</pre>
68
 
69
<h3>Description</h3>
70
<p>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.</p>
71
 
72
<h3>Parameters</h3>
73
<ul>
74
        <li>key: The 32 digit key you received from currencylayer.com</li>
75
        <li>UserMode: If true, the API key will be written to <code>HKEY_LOCAL_USER</code>, otherwise it will be written to <code>HKEY_LOCAL_MACHINE</code>.</li>
76
        <li>DontShowErrors: If true, no errors will be displayed. If true, errors will result in a dialog box, in addition to the result code.</li>
77
</ul>
78
 
79
<h3>Returns</h3>
80
<ul>
81
        <li>S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.</li>
82
        <li>E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured, e.g. if the registry is write protected.</li>
83
        <li>E_VTSCONV_BAD_ARGS (0xA0000001) if the key is invalid.</li>
84
</ul>
85
 
86
<h2 id="ReadAPIKey">ReadAPIKey</h2>
87
 
88
<h3>Syntax</h3>
89
<h4>Delphi</h4>
90
<pre>function ReadAPIKey(key: LPTSTR; DontShowErrors: BOOL): HRESULT; stdcall;
91
function ReadAPIKeyW(key: LPWSTR; DontShowErrors: BOOL): HRESULT; stdcall;
92
function ReadAPIKeyA(key: LPSTR; DontShowErrors: BOOL): HRESULT; stdcall;
93
</pre>
94
<h4>C</h4>
95
<pre>HRESULT __stdcall ReadAPIKeyW(LPWSTR key, BOOL DontShowErrors);
96
HRESULT __stdcall ReadAPIKeyA(LPSTR key, BOOL DontShowErrors);
97
</pre>
98
 
99
<h3>Description</h3>
100
<p>Reads the API key from the registry.</p>
101
 
102
<h3>Parameters</h3>
103
<ul>
104
        <li>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).</li>
105
        <li>DontShowErrors: If true, no errors will be displayed. If true, errors will result in a dialog box, in addition to the result code.</li>
106
</ul>
107
 
108
<h3>Returns</h3>
109
<ul>
110
        <li>S_VTSCONV_OK (0x20000000) if the key could be successfully deleted.</li>
111
        <li>E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured, e.g. if the registry is write protected.</li>
112
        <li>E_VTSCONV_STOREDKEY_INVALID (0xA0000002) if the key stored in the registry is invalid.</li>
113
        <li>E_VTSCONV_NO_STOREDKEY (0xA0000003) if there is no key stored in the registry.</li>
114
</ul>
115
 
116
<h2 id="Convert">Convert</h2>
117
 
118
<h3>Syntax</h3>
119
<h4>Delphi</h4>
120
<pre>function Convert(Value: Double; CurFrom, CurTo: LPCTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall;
121
function ConvertW(Value: Double; CurFrom, CurTo: LPCWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall;
122
function ConvertA(Value: Double; CurFrom, CurTo: LPCSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Double; stdcall;
123
</pre>
124
<h4>C</h4>
125
<pre>double __stdcall ConvertW(double Value, LPCWSTR CurFrom, LPCWSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate);
126
double __stdcall ConvertA(double Value, LPCSTR CurFrom, LPCSTR CurTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate);
127
</pre>
128
 
129
<h3>Description</h3>
130
<p>Converts into a differnt currency.</p>
131
 
132
<h3>Parameters</h3>
133
<ul>
134
        <li>Value: The amount of money in the source currency you want to convert into the target currency.</li>
135
        <li>CurFrom: The source currency, formatted as defined in ISO-4217 (3 chars, e.g. "USD")</li>
136
        <li>CurTo: The target currency, formatted as defined in ISO-4217 (3 chars, e.g. "USD")</li>
137
        <li>MaxAge: Defines, after which amount of time the exchange data needs to be re-downloaded from the server.<ul>
138
                <li>-1: Only download once</li>
139
                <li>0: Always download, on each request (attention: API keys may have limited amount of accesses per month)</li>
140
                <li>&gt;0: Download after the supplied amount of time (in seconds)</li>
141
        </ul></li>
142
        <li>Flags: Is a sum of following components:<ul>
143
                <li>CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.</li>
144
                <li>CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.</li>
145
                <li>CONVERT_USE_SSL (4): Use SSL to download the data. Note that only a paid subscription allows download via SSL.</li>
146
                <li>CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.</li>
147
                <li>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.</li>
148
        </ul></li>
149
        <li>HistoricDate:<ul>
150
                <li>0: Use the current exchange data</li>
151
                <li>any valid DATE: use an historic exchange</li>
152
        </ul></li>
153
</ul>
154
 
155
<h3>Returns</h3>
156
<ul>
157
        <li>-1 if an error occured</li>
158
        <li>&gt;=0 the amount of money in the target currency</li>
159
</ul>
160
 
161
<h2 id="AcceptedCurrencies">AcceptedCurrencies</h2>
162
 
163
<h3>Syntax</h3>
164
<h4>Delphi</h4>
165
<pre>function AcceptedCurrencies(WriteTo: LPTSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall;
166
function AcceptedCurrenciesW(WriteTo: LPWSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall;
167
function AcceptedCurrenciesA(WriteTo: LPSTR; MaxAge: integer; Flags: TVtsCurConvFlags; HistoricDate: TDate): Integer; stdcall;
168
</pre>
169
<h4>C</h4>
170
<pre>int __stdcall AcceptedCurrenciesW(LPWSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate);
171
int __stdcall AcceptedCurrenciesA(LPSTR WriteTo, int MaxAge, CURCONV_FLAGS Flags, DATE HistoricDate);
172
</pre>
173
 
174
<h3>Description</h3>
175
<p>Shows a list of available currencies.</p>
176
 
177
<h3>Parameters</h3>
178
<ul>
179
        <li>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.</li>
180
        <li>MaxAge: Defines, after which amount of time the exchange data needs to be re-downloaded from the server.<ul>
181
                <li>-1: Only download once</li>
182
                <li>0: Always download, on each request (attention: API keys may have limited amount of accesses per month)</li>
183
                <li>&gt;0: Download after the supplied amount of time (in seconds)</li>
184
        </ul></li>
185
        <li>Flags: Is a sum of following components:<ul>
186
                <li>CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.</li>
187
                <li>CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.</li>
188
                <li>CONVERT_USE_SSL (4): Use SSL to download the data. Note that only a paid subscription allows download via SSL.</li>
189
                <li>CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.</li>
190
                <li>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.</li>
191
        </ul></li>
192
        <li>HistoricDate:<ul>
193
                <li>0: Use the current exchange data</li>
194
                <li>any valid DATE: use an historic exchange</li>
195
        </ul></li>
196
</ul>
197
 
198
<h3>Returns</h3>
199
<ul>
200
        <li>-1 if an error occured</li>
201
        <li>&gt;=0 the number of currencies found/written</li>
202
</ul>
203
 
204
<h2 id="DownloadNow">DownloadNow</h2>
205
 
206
<h3>Syntax</h3>
207
<h4>Delphi</h4>
208
<pre>function DownloadNow(Flags: TVtsCurConvFlags; HistoricDate: TDate): HRESULT; stdcall;
209
</pre>
210
<h4>C</h4>
211
<pre>HRESULT __stdcall DownloadNow(CURCONV_FLAGS Flags, DATE HistoricDate);
212
</pre>
213
 
214
<h3>Description</h3>
215
<p>Forces the framework to download the currency table.</p>
216
 
217
<h3>Parameters</h3>
218
<ul>
219
        <li>Flags: Is a sum of following components:<ul>
220
                <li>CONVERT_DONT_SHOW_ERRORS (1): Don't show errors in a dialog box.</li>
221
                <li>CONVERT_FALLBACK_TO_CACHE (2): If download failed, use the previous downloaded cache file, even if it is older than MaxAge.</li>
222
                <li>CONVERT_USE_SSL (4): Use SSL to download the data. Note that only a paid subscription allows download via SSL.</li>
223
                <li>CONVERT_CONFIRM_WEB_ACCESS (8): Ask the user each time the API tries to download from the web.</li>
224
                <li>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.</li>
225
        </ul></li>
226
        <li>HistoricDate:<ul>
227
                <li>0: Use the current exchange data</li>
228
                <li>any valid DATE: use an historic exchange</li>
229
        </ul></li>
230
</ul>
231
 
232
<h3>Returns</h3>
233
<ul>
234
        <li>S_VTSCONV_OK (0x20000000) if the download was successful.</li>
235
        <li>E_VTSCONV_GENERIC_FAILURE (0xA0000000) if an error occured.</li>
236
</ul>
237
 
238
<hr>
239
 
13 daniel-mar 240
<p><i>Last change: 27 Aug 2017</i></p>
11 daniel-mar 241
 
242
</body>
243
 
2 daniel-mar 244
</html>