Changeset 305 for Common/UCommon.pas
- Timestamp:
- Jan 3, 2012, 10:31:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r290 r305 61 61 procedure DeleteFiles(APath, AFileSpec: string); 62 62 procedure OpenWebPage(URL: string); 63 procedure OpenFileInShell(FileName: string); 64 procedure ExecuteProgram(CommandLine: string); 63 65 64 66 … … 285 287 L := MAX_USERNAME_LENGTH + 2; 286 288 SetLength(Result, L); 287 if Windows.GetUserName(PChar(Result), L) and (L > 0) then 288 SetLength(Result, StrLen(PChar(Result))) else 289 Result := ''; 289 if Windows.GetUserName(PChar(Result), L) and (L > 0) then begin 290 SetLength(Result, StrLen(PChar(Result))); 291 Result := UTF8Encode(Result); 292 end else Result := ''; 290 293 end; 291 294 … … 365 368 end; 366 369 370 procedure ExecuteProgram(CommandLine: string); 371 var 372 Process: TProcess; 373 begin 374 try 375 Process := TProcess.Create(nil); 376 Process.CommandLine := CommandLine; 377 Process.Options := [poNoConsole]; 378 Process.Execute; 379 finally 380 Process.Free; 381 end; 382 end; 383 367 384 procedure OpenWebPage(URL: string); 368 385 var … … 376 393 //Process.Executable := Browser; 377 394 //Process.Parameters.Add(Format(Params, [ApplicationInfo.HomePage]); 378 Process.Executable := 'cmd.exe'; 379 Process.Parameters.Add('/c'); 380 Process.Parameters.Add('start'); 381 Process.Parameters.Add(URL); 395 Process.CommandLine := 'cmd.exe /c start ' + URL; 382 396 Process.Options := [poNoConsole]; 383 397 Process.Execute; … … 387 401 end; 388 402 403 procedure OpenFileInShell(FileName: string); 404 begin 405 ExecuteProgram('cmd.exe /c start ' + FileName); 406 end; 389 407 390 408 initialization
Note:
See TracChangeset
for help on using the changeset viewer.