A guide to developing Delphi programs in Windows API (without the use of the VCL
About the course:
This free online course is perfect for intermediate Delphi developers as well as for those who want a broad overview of the art of Windows API programming with Borland Delphi.The course is written by Wes Turner, brought to you by Zarko Gajic
Overview:
The focus here is programming without Delphi's Visual Component Library (VCL) using Windows "Application Programming Interface" (API) functions to create applications without the Forms.pas unit, resulting in knowledge of the Windows programming interface and smaller executable's file size.There are always a variety of ways to code things, the chapters of this course are meant to help those developers that did not learn the windows API functions for window creation and messaging as they are not covered in Delphi Rapid Application Development (RAD) instructions.
This Guide is about developing Delphi programs without the "Forms" and "Controls" units or any of the Component Library. You will be shown how to create windows classes and windows, how to use the "Message Loop" to pass messages to the WndProc message handling function, etc...
Prerequisites:
Readers should be experienced in developing Windows applications. It would be good if you are familiar with general Delphi coding methods (for loops, typecasting, case statements, etc).Chapters:
You can find the latest chapters located at the bottom of this page!The chapters of this course are being created and updated dynamically on this site. Chapters (for now) include:
Introduction:
Delphi is an excellent rapid application development (RAD) tool and can produce outstanding programs.Delphi users will notice that most of the Windows API code is hidden from them, and handled in the background in the "Forms" and "Controls" units. Many Delphi developers think they are programming in "Windows" environment, when they are really working in "Delphi" environment with Delphi code "wrappers" for the Windows API functions. When you need more programming options than is offered in the Object Inspector or component (VCL) methods, it becomes necessary to use Windows API to accomplish these options. As your programming goals become more specialized you may find that the click and double click ease of the Delphi VCL will not have the variety and creativity needed for unique methods and visual display, requiring your API knowledge for a lager variety of programming tools.
The file size of a "standard" Delphi application is at least 250 Kb, due to the "Forms" unit, which will include a lot of code that may not be needed. Without the "Forms" unit, developing in API means that you will be coding in the .dpr (program) unit of your app. There will not be a usable Object Inspector or any components, this is NOT RAD, it is slow and there is no visual "Form" to see during development. But by learning how to do this you will begin to see how the Windows OS operates and uses window creation options and windows "messages" to do things. This is very useful in Delphi RAD with the VCL, and almost essential for VCL component development. If you can find the time and patients to learn about windows messages and message handling methods, you will greatly increase your ability to use Delphi, even if you don't use any API calls and only program with the VCL.
CHAPTER 1:
Reading C code in Win32 API
When you read the Win32 API help, you see that the "C" language syntax is used. This article will help you learn the differences between the C language types and the Delphi language types.
Discuss about questions, comments, problems and solutions related to this chapter!
CHAPTER 2:
Your first raw API Delphi program
Let's make a formless program that gets user input and creates a file (populated with system information), using only Windows API calls.
Discuss about questions, comments, problems and solutions related to this chapter!
CHAPTER 3:
Creating an API GUI Windows program with message loop
Let's see how to create a Windows GUI program with windows and a message loop. Here's what you'll find in this chapter: an intro to Windows messaging (with a discussion on message structure) ; about the WndMessageProc function, handles, the CreateWindow function, and much more.
Discuss about questions, comments, problems and solutions related to this chapter!
More coming...