GetModuleName (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires a button and a label. When you click the button, the GetModuleName function retrieves the path and name of the project executable using the file handle HInstance.

Code

function GetUsersFileName: string;
begin
  Result := SysUtils.GetModuleName(HInstance);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := GetUsersFileName;
end;

Uses