The Intermediate Guide to Windows App Development

Windows app development is quite a large subject when you go beyond just scratching the surface. There are several different kinds of Windows app development beyond just the regular GUI application. In this article we take a look at a few of the other types of app such as Windows services, web server apps and even DLLs for Apache web servers.

In Windows app development, what is a Windows Service?

Windows Services are kinds of applications that run in the background. They are, most of the time are, non-UI applications. Windows services are usually registered to trigger when the OS boots and is scheduled to run in the background to execute some tasks. Moreover, Windows services can be started automatically or manually by Pause, Stop and Restart commands over Windows services.

With these features in your application, you can create long-running apps that run in their own Windows sessions without interfering with other users working on the same computer. 

You can easily create your service applications with Delphi and C++. This simple demonstration will teach us to make our service app with Delphi. 

The Intermediate Guide to Windows App Development: the task manager.

What are some examples of Windows Services?

  • Windows auto-update
  • Folder and file scanning
  • SQL Server agent
  • Auto checker for emails

Using the Services control app, you can see and control all the available services in your Windows machine.

The Intermediate Guide to Windows App Development. Screen showing the task manager.

How can I create a Windows Service using Delphi?

Install the latest Delphi CE (Community Edition) and start it. Select:

File -> New -> Other -> Delphi -> Windows -> Windows Service

The Intermediate Guide to Windows App Development: the RAD Studio Delphi IDE with the Windows service app type selected.

The TService class accomplishes connection and interfacing with Windows Service Manager. TService defines the Windows service we are developing like event handlers for communicating with the Windows OS.

The Intermediate Guide to Windows App Development. A screen shot of the basics of a Windows service.

As you can expect, the service must work in the background and need to respond to messages to the OS commands independently. To do this, we need to create a new event on the TService called OnExecute.

Service applications should answer the Windows ServiceController commands independently of what it is doing, so we need a background thread to do the actual work. The code above o the OnExecute event waits and handles the ServiceController commands, not real work. 

Be sure to check out the official documentation on creating Windows Services using Delphi and C++ Builder.

For Windows app development, what are Packages and how can I create them?

Delphi has two different types of packages, runtime packages and design-time packages. Runtime packages are meant to be distributed with applications, just like DLLs, to keep down the executable size and prevent spreading duplicate code. The Delphi IDE can load design-time packages. They can contain code to register components with the component palette. Another intention is that write the DLLs that you want to share between your programs and another application in a different programming language. 

Check out the official documentation to learn how to create packages and dynamic link libraries with Delphi and C++ Builder here!

What kind of Web Server Windows App development can be done with Delphi?

Delphi is a full-stack programming language that you can develop:

  • Windows apps
  • macOS apps
  • Android apps
  • iOS apps
  • Linux apps
  • Web apps
  • Embedded apps

Except for Delphi’s native frameworks and libraries for Web Server app development, there are lots of free and open-source frameworks that give you the ability to create server/client-focused web server apps with Delphi. Some tools like IntraWeb or FMSoft uniGUI provide a robust and mature environment to build full-stack web apps with Delphi.

What is ISAPI?

You can create an ISAPI and NSAPI web server application, a DLL loaded by the Web server. Client request information is passed to the DLL as a structure and evaluated by the ISAPI or NSAPI application that creates appropriate request and response objects. Moreover, each request message is automatically handled in a separate execution thread.

What does “CGI stand-alone” mean?

A CGI stand-alone Web server application is a console application that receives client request information on standard input and passes the results back to the server on standard output. This data is evaluated by the CGI application, which creates an appropriate request and response objects. A separate instance of the application handles each request message.

What is an Apache Dynamic Link module?

Apache Webserver applications are DLLs loaded by the Web Server. So, when there is the information passed to the DLL, it processes it and returns it to the client by the Web server.

Moreover, with Stand-alone Console Apps, you can create a web server that supports HTTP using the Indy HTTP server component. So, this has a text-only user interface.

Be sure to check out the official documents to learn about Web Server development.

Download a free trial of RAD Studio Delphi today and try some of the examples mentioned in this article.

RAD Studio What's New