//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "GetModuleName.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: GetModuleName
// Routine: SysUtils.GetModuleName
// Enumeration: SysInit.HInstance

// BeginCode
/*
This example requires a button and a label.  When the user clicks
the button, the GetModuleName function retieves the path and name
of the project executable using the file handle HInstance.
*/
AnsiString __fastcall GetUsersFileName(void)
{
  return GetModuleName(unsigned(HInstance));
}

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