Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.453 Beiträge
Delphi 12 Athens
|
AW: application.exename
26. Jul 2017, 11:50
Schön wäre es dennoch und kürzeren Code hätte man dann auch.
Bitteschön:
Delphi-Quellcode:
interface
uses
System.IOUtils;
type
TPathHelper = record helper for TPath
private
public
function GetDesktopFolder: string;
function GetStartMenuFolder: string;
end;
implementation
uses
Winapi.SHFolder, Winapi.ShlObj;
function TPathHelper.GetDesktopFolder: string;
var
LStr: array[0 .. MAX_PATH] of Char;
begin
SetLastError(ERROR_SUCCESS);
if SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, 0, @LStr) = S_OK then
Result := LStr;
end;
function TPathHelper.GetStartMenuFolder: string;
var
LStr: array[0 .. MAX_PATH] of Char;
begin
SetLastError(ERROR_SUCCESS);
if SHGetFolderPath(0, CSIDL_STARTMENU, 0, 0, @LStr) = S_OK then
Result := LStr;
end;
|
|
Zitat
|