How create a new uniGUI application

First Open your Delphi.You can easily create a new uniGUI application through the uniGUI application wizard in the Delphi IDE (you must use this method to create a new uniGUI application), and follow the wizard interface prompts.
(1) Use uniGUI application wizard to create a new uniGUI application, the main steps are
- File->New->Other

2. Select uniGUI for Delphi-> Application Wizard, click “OK”

3. Fill in the project name and project storage directory, and select a project type as required (I usually choose the first one when developing and learning), click “OK”, the system will automatically generate related project codes and several modules and forms.


At this point, the architecture of an application project is automatically generated by the UniGUI wizard. From the above figure, we can see that several modules and forms are automatically generated.Each uniGUI application is composed of a dedicated form of a main form (MainForm) and two dedicated modules (MainModule) and a service module (ServerModule) and is automatically created. The login form (LoginForm) can be selected or added depending on the situation (similar to additional addition, which will be discussed later, there is no here).
1. Standalone Server
The simplest type of project is a standalone server. In this mode, the application server runs directly like a desktop application. It is also a mode for debugging applications. After running the application executable file (it is an EXE file), it will be minimized to the tray icon and run until the user manually terminates it. See below:

An independent application can be accessed from a browser. Just type: http://localhost:8077 in the address bar, where 8077 is the default dedicated port number (listening port) that the application is bound to. Developers can easily modify it in the server module (ServerModule). Standalone mode is only recommended for debugging purposes.
Because it runs as a desktop application, it will be terminated when the current user logs out. Moreover, it will not start automatically after restarting. The mode is most suitable for debugging during development. When your application is running in debug mode, you can set breakpoints, pause, go to the cursor position, and use all the other advanced debugging features of Delphi IDE to debug your application, just like any other VCL application same. It is not recommended to use this mode in a formal use environment because it will not automatically run when the OS restarts. In addition, it can be easily terminated by unauthorized user intervention.
The standalone server project is the simplest type of uniGUI project. It creates an application (EXE file) that runs similar to a desktop application, that is, the application is started and terminated by the user. This type of application is best for debugging purposes. The following is a sample DPR file for a typical newly created standalone server project.
program Project1;
uses
Forms,
ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule},
MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
Main in 'Main.pas' {MainForm: TUniForm};
{$R *.res}
begin
Application.Initialize;
TUniServerModule.Create(Application);
Application.Run;
end.
2. ISAPI Module
This technology was originally applied to Microsoft IIS products by Microsoft using Windows-based DLL technology. Of course, there are other web servers, such as Apache, which also support loading ISAPI mode. ISAPI mode differs from the previously discussed options in many ways. Most importantly, it does not include a built-in Web server, rather than stand-alone services and Windows services. In ISAPI mode, the IIS server is an HTTP server, and the ISAPI module executes its requests. You can use the uniGUI wizard in Delphi IDE to easily create ISAPI mode applications. After compilation, the uniGUI application will output DLL files instead of EXE files. This DLL file must be deployed to the IIS server (detailed in the ISAPI mode of the Web deployment section). The DLL file generated by uniGUI application supports all IIS versions starting from IIS 5.1. ISAPI mode provides developers with the freedom to deploy many modules on the same server without the need to choose different ports for each application. It also inherits the advantages of all advanced security features in Microsoft IIS.
Running an ISAPI application is as simple as opening the following URL in a browser, and the access format is as follows:
http://localhost/appdir/app.dll
If you have multiple applications in the same folder, you can call them by specifying a different DLL name:
http://localhost/appdir/app.dll
http://localhost/appdir/app2.dll
http://localhost/appdir/appaccount.dll
If you plan to start an ISAPI mode project and choose it as the default deployment method, you can choose this type of project. This project will generate a DLL when compiled. ISAPI modules can be deployed to Microsoft® IIS server or Apache server for Windows. Below is a sample DPR file of a typical newly created ISAPI module project.
library Project1;
uses
uniGUIISAPI,
ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule};
{$R *.res}
exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;
end.
3. Standalone Server/ISAPI module
This type of project uses conditional compilation instructions to create a combined project of one of the above two types: standalone server or ISAPI module. If the goal of ISAPI module deployment is formal use, then this type of project is a very good start. Just comment out the first line of the DPR file to convert the stand-alone server to ISAPI DLL.
{$define UNIGUI_VCL} // Comment out this line (that is to say: {.$define UNIGUI_VCL}), you can use this item to change to an ISAPI mode
{$ifndef UNIGUI_VCL}
library
{$else}
program
{$endif}
Project1;
uses
uniGUIISAPI,
Forms,
ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule},
MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
Main in 'Main.pas' {MainForm: TUniForm};
{$R *.res}
{$ifndef UNIGUI_VCL}
exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;
{$endif}
begin
{$ifdef UNIGUI_VCL}
Application.Initialize;
TUniServerModule.Create(Application);
Application.Run;
{$endif}
end.
By default, the above project will generate an EXE file, which is an independent server. If you comment out the first line of the project, it will become an ISAPI module (see the instructions and steps below for details). Later, you can convert it back to standalone EXE mode by deleting the comment in the first line. Let’s talk about the methods and steps of mutual conversion.
Steps to convert the combined project to ISAPI DLL:
1) Open the DPR file.
2). Change the first line of the DPR file to (that is, add a “.” after {to comment out the condition of this line): {.$define UNIGUI_VCL}
3). If your Delphi version is XE2 or newer, you need to close the project and reopen it. (If your Delphi version is older than XE2, this step is not required)
4) Build your application.
5). The DLL file will be created in the output folder.
Steps to convert the combined project back to standalone mode:
1) Open the DPR file.
2). Change the first line of the DPR file to: {$define UNIGUI_VCL}
3). If your Delphi version is XE2 or newer, you need to close the project and reopen it. (If your Delphi version is older than XE2, this step is not required)
4) Build your application.
5). The EXE file will be created in the output folder.
4. Windows Services
By creating a uniGUI Windows service application, the application can be deployed as a standard Windows service application. This method is one of the preferred methods for formal use of the environment. Every time the system restarts, the Windows service will run automatically. It will guarantee the availability of web applications. Windows service applications can be accessed from a browser like the standalone server described above, which means that each Windows service application requires a dedicated port (unused dedicated port).
Another deployment method for the formal environment is Windows Services. It created a standard Delphi Windows service project and made some modifications to allow uniGUI ServiceModule to be created. The service project generates standard Windows service executable files, which can be installed like any regular Windows service. The Windows service is automatically started by Windows. As long as Windows is running, you can ensure that it is always available. This provides a high level of usability for uniGUI applications.
program Project1;
uses
SvcMgr,
ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule},
MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
Main in 'Main.pas' {MainForm: TUniForm},
ServiceModule in 'ServiceModule.pas' {UniServiceModule: TUniGUIService};
{$R *.res}
begin
if not Application.DelayInitialize or Application.Installing then
Application.Initialize;
Application.CreateForm(TUniServiceModule, UniServiceModule);
Application.Run;
end.
Remarks: New programs or projects start from here. The relevant code above is also automatically generated.