/[projects]/dao/DelphiScanner/Utils.pas
ViewVC logotype

Diff of /dao/DelphiScanner/Utils.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2995 by torben, Thu Sep 3 14:40:49 2015 UTC revision 2996 by torben, Fri Apr 8 14:01:34 2016 UTC
# Line 30  type Line 30  type
30    
31      class function FileTime2DateTime(FileTime: TFileTime): TDateTime;      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;
# Line 42  uses StrUtils, Line 46  uses StrUtils,
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    
# Line 293  begin Line 300  begin
300  end;  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.

Legend:
Removed from v.2995  
changed lines
  Added in v.2996

  ViewVC Help
Powered by ViewVC 1.1.20