2012-02-27

In my Delphi application, I would like to add command line parameters to automatically set some parameters in the login screen.

Currently I have a login screen where the user sets some information (like Server, database, user, password, AuthenticationType, AUtoLogin, ...).

I use MRU to populate the fields. Anyway, in big organizations, there is the need to do not let the user choose any info. For this, the simplest thing I can do in my scenario is to use command line parameters.

My question is how do you suggest to choose the command line parameters? I mean, should I go for a "position" approach or for some "tag" approach, for example:

or

In the first case I need to loop across all parameters using ParamStr and "decode" what they are. If they start with "-s:" I know that what follows is the server name. The second is more quick and dirty but may be more effective.

How to manage parameters that contain a "space"? Is it possible to automatically intercept them with ParamStr or should I handle all manually? (I mean is there a way to automatically tell to ParamStr that a parameter is containing a space (like using curly brackets or something).

What is the best practice?

Show more