GetModuleName (C++)

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

String __fastcall GetUsersFileName(void)
{
  return GetModuleName(unsigned(HInstance));
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Label1->Caption = GetUsersFileName();
}

Uses