Windows – Get arguments with visual library FMXMain

  

I’m trying to get the arguments declared in ProjectName.cpp file (the file of the application) wich contains the following autogenerated code:

extern “C” int FMXmain()
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TfrmPrincipal), &frmPrincipal);
Application->CreateForm(__classid(TfrmCarregar), &frmCarregar);
Application->CreateForm(__classid(TfrmCodigo), &frmCodigo);
Application->CreateForm(__classid(TfrmConfig), &frmConfig);
Application->CreateForm(__classid(TfrmImgConf), &frmImgConf);
Application->CreateForm(__classid(TfrmSobre), &frmSobre);
Application->CreateForm(__classid(TfrmTradutor), &frmTradutor);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (…)
{
try
{
throw Exception(“”);
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}

I just would like to get the arguments when the application is launched, so i’ve tried to change the declaration of the function to:

extern “C” int FMXmain(String argv)

and

extern “C” int FMXmain(wchar_t* argv[]) // as I may need wide char support (TCHAR doesn’t seems to be useful in this case)

or (the default)

extern “C” int FMXmain(char* argv[])

The only doubt I have is how to pass the value I get to the main form. Should I pass it after creation or after the application is already running? How do I do it?

OBS: Main form: frmPrincipal

If I’m making something wrong, please tell me.
PS.: I’m just trying to get the file path after double click on it (I’ve already gotten the function wich will link my application to the registry)

References that helped me a little bit:

WIKI
Double Click on Your File(extension) & open it with your EXE(application)
Opening c++ program by double clicking associated file. How do I get the file name?

Since now,
Thank you A LOT.

Comments are closed.