Developing Delphi programs in Windows API without the Forms unit |
Welcome to the DelphiZeus web pages Here you will find help with the computer programing platform of Delphi, a Pascal language development application. The focus here is programing and developing code without Delphi's Visual Component Library using Windows 32-bit "Application Programming Interface" (API) fuctions 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, these pages are meant to help those delphi coders that did not learn the windows API functions for window creation and messaging that are not covered in Delphi Rapid Application Development (RAD) instuctions. At DelphiZeus you can see some instructions, Code and Tips about making programs without the "Forms" and "Controls" units or any of the Component Library. You will be shown how to create windows Classes and the windows, then use the "Message Loop" to pass messages to the WndProc message handling function. Delphi 5 was used for the examples here, but since this is API, many of the delphi versions can use this code. Versions of 32-bit Delphi before 4, (in versions 2 and 3), have their Integer type as a 16-bit type, so it will be nessary to change the "Integer type" here to 32-bit LongInt type, and change the 16-bit "Cardinal type" to 32-bit DWORD. Also those versions do not automaticaly dereference pointers. The file size of a RAD Delphi 5 App is at least 250 Kb, due to the "Forms" unit, which will include alot of code that may not be needed. Here the "Forms" unit will Not be used, developinging in API means that you will be coding all of the windows creation and message handling, I will first show you how to program in the project file .DPR (program) of your application. 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 developement. 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. Which is very useful in Delphi RAD with the VCL, and almost essential for VCL WinControl Component development. If you can find the time and patients to learn windows creation and message methods, you will greatly increase your ability to use Delphi, even if you don't use only API and program with the VCL. Since this about using API and coding without the VCL, I start with a lesson about using the delphi "Project file", with the .dpr extention. This gives some examples of programs that use API but do not have a Graphic User Interface, and no windows are created. Then in Lesson 2 there are examples for creating windows and some explanation for the many options in this creation. Also there is some explanation of the convoluted workings of the window's "Message" operations and methods. Then more lessons follow about graphic operations, using fonts, pens and brushes on a Device Context. In the Buttons and Edit Controls lesson there's more about creating and using Controls (buttons, edit and static). Some pages are still under constuction. To use these pages, it would be good if you are familiar with general Pascal coding methods (for loops, typecasting, case statements, ect) and some experience with Delphi, this may be tough for a Delphi programming Beginner. Email comments, sugestions, code correction, questions, or improvement ideas, to
Contents
1. - Creating a .dpr program
1a. - Reading the C code in Win32 API Help
2. - Making a API window and message loop program
3. - More Messages and Changing Windows Properties
4. - PChar, it's a Pointer
5. - Fonts and using HDC
6. - Brushes and Pens, with intro to timers
7. - Buttons and Edit Controls
8. - Using Dialogs
9. - Non-Modal Dialogs and Scroll Bars
10. - Menus and Listboxes
11. - Code In Units, Combo Boxes
12. - Programs with XP Themes
13. - MakeApp a Universal Unit
13a. - Example code for MakeApp Unit
13b. - A Visual "Graphic" Control Unit
13c. - Example code for GrafCtrl Unit
14. - Using System Open and Save Dialogs
15. - Reading and Writing Disk Files
15a. - Program Code for Using Files
16. - More Top Level "PopUp" Windows
16A. - A Unit for Modal Message Windows
17. - Tray Icons in your Program
18. - a Text Editing Program (like Notepad)
19. - A Note Posting Program with List Box
20. - Using MuliMedia and Thread Timers
Has functions to save Icon files in 256 and Full Color Formats
22. - Builing Custom Files with TFileStream
23. - Creating HTML Dialog Boxes Search for a word here - This is a limited word search of this site
|