24 |
|
|
25 |
class function Sto_GetFmtFileVersion(const FileName: String = ''): String; |
class function Sto_GetFmtFileVersion(const FileName: String = ''): String; |
26 |
|
|
27 |
|
class function CheckUrl(url:string): boolean; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
38 |
Windows, |
Windows, |
39 |
Messages, |
Messages, |
40 |
SysUtils, //IntToStr etc |
SysUtils, //IntToStr etc |
41 |
Registry |
Registry, |
42 |
|
wininet //CheckUrl |
43 |
|
|
44 |
; |
; |
45 |
|
|
239 |
end; |
end; |
240 |
|
|
241 |
|
|
242 |
|
class function TUtils.CheckUrl(url:string):boolean; |
243 |
|
var |
244 |
|
hSession, hfile: hInternet; |
245 |
|
dwindex,dwcodelen :dword; |
246 |
|
dwcode:array[1..20] of char; |
247 |
|
res : pchar; |
248 |
|
begin |
249 |
|
if pos('http://',lowercase(url))=0 then |
250 |
|
url := 'http://'+url; |
251 |
|
Result := false; |
252 |
|
hSession := InternetOpen('InetURL:/1.0', |
253 |
|
INTERNET_OPEN_TYPE_PRECONFIG, |
254 |
|
nil, |
255 |
|
nil, |
256 |
|
0); |
257 |
|
if assigned(hsession) then |
258 |
|
begin |
259 |
|
hfile := InternetOpenUrl(hsession, |
260 |
|
pchar(url), |
261 |
|
nil, |
262 |
|
0, |
263 |
|
INTERNET_FLAG_RELOAD, |
264 |
|
0); |
265 |
|
dwIndex := 0; |
266 |
|
dwCodeLen := 10; |
267 |
|
HttpQueryInfo(hfile, |
268 |
|
HTTP_QUERY_STATUS_CODE, |
269 |
|
@dwcode, |
270 |
|
dwcodeLen, |
271 |
|
dwIndex); |
272 |
|
res := pchar(@dwcode); |
273 |
|
result:= (res ='200') or (res ='302'); |
274 |
|
if assigned(hfile) then |
275 |
|
InternetCloseHandle(hfile); |
276 |
|
InternetCloseHandle(hsession); |
277 |
|
end; |
278 |
|
|
279 |
|
end; |
280 |
|
|
281 |
end. |
end. |