Two different versions of the same application

I have software created since Delphi 2010, and it should be used from two different departments, both of which have the same data and the same user interface, with the exception of some changes, such as hide / add buttons, forms and grid columns. Therefore, two versions of the same application are required.

It is not possible to invite the user to start the application to select the department that should use separate EXEs.

What is the best approach (concept) for this in Delphi 2010 or XE3 (will be updated later)? Is it possible to compile various exe names?

+4
source share
4 answers

Sounds like a maintenance nightmare, so please consider other solutions, such as those suggested in the comments, such as the login file or settings.

If you want to make a separate exe, you can use the compiler and based on the definition in / exclude parts of the code:

Add a new configuration:

enter image description here

Add a definition to the configuration: enter image description here

Use the definition in your code:

{$IFNDEF ADVANCED} // Remove Event Handler Button1.OnClick := nil; // Hide Button Button1.Visible := False; {$ENDIF} 
+9
source

I can come up with several solutions for this:

  • Provide the INI file to your application (or create a registry key on the client machine) to indicate / determine in which department your application is used. then read the values ​​through a TIniFile or TRegistry , for example an INI file ( MyApp.ini ):

    [Options]
    Sales Department =

  • Create a shortcut for your program and use options, for example. "MyApp.exe /sales" or "MyApp.exe /support" ( ParamStr(1) will tell you if it is /sales against /support )

  • Use two separate project files, and in each version of the project specify your Conditionals directive, for example SALES or SUPPORT , then use {$IFDEF SALES}...{$ENDIF} in your code - with these parameters it is very important to completely rebuild all units of the project . (I have a pre-build script that deletes * .dcu project files before compiling it).

+9
source

You need to have a permission system in your application that can be configured for different groups and profiles, and you can assign roles or specific permissions to all the end users who will use the application, you can develop it yourself or you can rely on a third party, such as TMS Security System

enter image description here

0
source

One of the possible things is to do the first project. Make your own app.

Then create a second project in the same folder and add all the units from the first project to this project.

Now in your second project, if you need only small changes, you can, for example, derive a new class from your main form in your first project and make changes to it.

So you have 2 exes, but with a common code base.

0
source

All Articles