3 |
interface |
interface |
4 |
uses |
uses |
5 |
Controls, |
Controls, |
6 |
Graphics //TColor |
Graphics, //TColor |
7 |
|
IniFiles, |
8 |
|
Windows //TFileTime |
9 |
; |
; |
10 |
|
|
11 |
type |
type |
28 |
|
|
29 |
class function CheckUrl(url:string): boolean; |
class function CheckUrl(url:string): boolean; |
30 |
|
|
31 |
|
class function FileTime2DateTime(FileTime: TFileTime): TDateTime; |
32 |
|
|
33 |
|
class function GetComputerNameHelper() : String; |
34 |
|
|
35 |
|
class function GetCurrentUserName : string; |
36 |
|
|
37 |
|
class function URLEncode(const s : string) : string; |
38 |
|
|
39 |
|
|
40 |
end; |
end; |
43 |
|
|
44 |
uses StrUtils, |
uses StrUtils, |
45 |
Types, //TRect , |
Types, //TRect , |
|
Windows, |
|
46 |
Messages, |
Messages, |
47 |
SysUtils, //IntToStr etc |
SysUtils, //IntToStr etc |
48 |
Registry, |
Registry, |
49 |
wininet //CheckUrl |
wininet, //CheckUrl |
50 |
|
|
51 |
|
HTTPApp //HTTPEncode |
52 |
|
|
53 |
|
|
54 |
; |
; |
55 |
|
|
288 |
|
|
289 |
end; |
end; |
290 |
|
|
291 |
|
|
292 |
|
class function TUtils.FileTime2DateTime(FileTime: TFileTime): TDateTime; |
293 |
|
var |
294 |
|
LocalFileTime: TFileTime; |
295 |
|
SystemTime: TSystemTime; |
296 |
|
begin |
297 |
|
FileTimeToLocalFileTime(FileTime, LocalFileTime) ; |
298 |
|
FileTimeToSystemTime(LocalFileTime, SystemTime) ; |
299 |
|
Result := SystemTimeToDateTime(SystemTime) ; |
300 |
|
end; |
301 |
|
|
302 |
|
|
303 |
|
class function TUtils.GetComputerNameHelper : String; |
304 |
|
var |
305 |
|
buffer: array[0..255] of char; |
306 |
|
size: dword; |
307 |
|
begin |
308 |
|
size := 256; |
309 |
|
if GetComputerName(buffer, size) then |
310 |
|
Result := buffer |
311 |
|
else |
312 |
|
Result := '' |
313 |
|
end; |
314 |
|
|
315 |
|
class function TUtils.GetCurrentUserName : string; |
316 |
|
const |
317 |
|
cnMaxUserNameLen = 254; |
318 |
|
var |
319 |
|
sUserName : string; |
320 |
|
dwUserNameLen : DWord; |
321 |
|
begin |
322 |
|
dwUserNameLen := cnMaxUserNameLen-1; |
323 |
|
SetLength( sUserName, cnMaxUserNameLen ); |
324 |
|
GetUserName(PChar( sUserName ),dwUserNameLen ); |
325 |
|
SetLength( sUserName, dwUserNameLen ); |
326 |
|
Result := sUserName; |
327 |
|
end; |
328 |
|
|
329 |
|
|
330 |
|
class function TUtils.URLEncode(const s : string) : string; |
331 |
|
begin |
332 |
|
result := HTTPEncode(s); |
333 |
|
end; |
334 |
|
|
335 |
|
|
336 |
end. |
end. |