Changeset 74 for trunk/Packages/Common/UCommon.pas
- Timestamp:
- Dec 17, 2016, 6:33:13 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UCommon.pas
r73 r74 6 6 7 7 uses 8 {$IFDEF Windows}Windows,{$ENDIF} 8 {$ifdef Windows}Windows,{$endif} 9 {$ifdef Linux}baseunix,{$endif} 9 10 Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, 10 11 FileUtil; //, ShFolder, ShellAPI; … … 69 70 function GetDirCount(Dir: string): Integer; 70 71 function MergeArray(A, B: array of string): TArrayOfString; 72 function LoadFileToStr(const FileName: TFileName): AnsiString; 71 73 72 74 … … 305 307 end; 306 308 end; 309 {$endif} 307 310 308 311 function ComputerName: string; … … 324 327 {$endif} 325 328 {$ifdef unix} 326 begin 327 Result := GetHostName; 329 var 330 Name: UtsName; 331 begin 332 fpuname(Name); 333 Result := Name.Nodename; 328 334 end; 329 335 {$endif} 330 336 337 {$ifdef windows} 331 338 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 332 339 const … … 443 450 444 451 procedure OpenWebPage(URL: string); 445 var446 Process: TProcess;447 Browser, Params: string;448 452 begin 449 453 OpenURL(URL); 450 {try451 Process := TProcess.Create(nil);452 Browser := '';453 //FindDefaultBrowser(Browser, Params);454 //Process.Executable := Browser;455 //Process.Parameters.Add(Format(Params, [ApplicationInfo.HomePage]);456 Process.CommandLine := 'cmd.exe /c start ' + URL;457 Process.Options := [poNoConsole];458 Process.Execute;459 finally460 Process.Free;461 end;}462 454 end; 463 455 … … 501 493 end; 502 494 495 function LoadFileToStr(const FileName: TFileName): AnsiString; 496 var 497 FileStream: TFileStream; 498 Read: Integer; 499 begin 500 Result := ''; 501 FileStream := TFileStream.Create(FileName, fmOpenRead); 502 try 503 if FileStream.Size > 0 then begin 504 SetLength(Result, FileStream.Size); 505 Read := FileStream.Read(Pointer(Result)^, FileStream.Size); 506 SetLength(Result, Read); 507 end; 508 finally 509 FileStream.Free; 510 end; 511 end; 512 503 513 504 514
Note:
See TracChangeset
for help on using the changeset viewer.