What you are going to learn today:
Windows Programming is what Delphi is about, but to use it efficiently, you must know a little bit of Windows' "Base System Architechture" (just some funny term thought up by some idiot...) Flip through and absorb - Windows Programming is one of the most interesting topics around, for us that is.
What is Windows?Skipping its infamous history, you can say that Windows is just simply the result of envious PC owners who wished that their computer would be 'easier to use'. When Apple Computer released the Macintosh, (which I still hail as the greatest invention of all time) developers started working on a similar operating system for the PC. Through some marketing and lots of tension, Windows became the forerunner of the whole lot. Today, Windows has become a sort of standard for all PCs. Almost all new computers are pre-installed with Windows 95, (I personally prefer doing the installation myself, but never mind), and almost all Windows programs today are comparable, or even better, than their DOS counterparts. How about that for a success story?
How do you program in Windows?Now that you know more about the history of Windows, we shall now talk about how Windows programming works. This chapter will make it easier for you to understand Delphi. (You are getting confused, right? Right?) You'll find out that Windows programming isn't that difficult - after you understand it of course.
First thing about Windows - it is a multi-tasking environment. That means that it actually caan run more than one program at one time, (supposedly) giving you higher efficiency. That gave the creators of Windows a lot of headaches. How can you have multiple programs running at the same time? You'll need to process code for each program simultaneously, which I assure you, is no easy feat. So, the makers of Windows created a system where each program was like a procedure - code was run only when the system requested for it. This meant that they needed to create a whole new system for Windows, containing the API (Application Program Interface) and other forms of trash. Code was in the form of 'events'. Only when an event occurs will code be run. Now you know why Delphi makes you type code that way!
But that's not all. Remember I told about something called the API? (It's just up there, stupid!) The API is actually just a whole lot of commands built into Windows to do what programmers need for Windows Programming. You may not know it, but Delphi gives you access to the API too! But don't worry if you look up the API and find millions of cammands - I bet you'll never use 85% of them in the end anyway.
Another thing. Have you ever wondered how come I like to start type definitions with the letter 'T'? Well, we call this Hungarian Notation and it's just a naming method to help programmers identify the data type of a variable quickly. I mention this because some of you may be getting the misconception that the 'T' is compulsary, while in actual fact the naming method comes from me programming in Windows too much. How come? Well, suffice it to say that Windows uses Hungarian Notation a lot, so look out! When you start typing SDK code, you may not recognize if it's a typo or if it's real!
How Delphi implements WindowsAs you've already seen, Delphi implements Windows very closely to how Windows programming is supposed to work. You attach code to events and API calls are allowed in your code. Delphi is probably the most efficient Windows programming environment isn't it? But that's not all. Tomorrow, you'll learn about Object-Orientated Programming, and you'll see how efficient Delphi is after all.