When we use the beautiful interface, convenient and quick application. We will find out how rough the program has been written before (TC program). Simple interface, 16-color display system, greatly behind the development of the computer. Simply put, it's overkill. How should we change this situation? Microsoft offers a simple solution when it comes to introducing Windows operating systems. This is the Windows Platform API application interface. Of course, the API is also developed, it from the win API developed to the current universal use of the win API. Only by fully understanding the function and usage of API function can we penetrate into the interior of Windows system to fully excavate the powerful function provided by the operating system. Now let's give up that DOS application and get into the ocean of Windows programming.
To understand the Windows API, we must first understand how programs in windows are driven. Students can clearly find that when you use Windows Notepad, when the keyboard input characters, the Word will appear on the screen. When you move the mouse, the cursor moves on the screen. When you double-click the mouse and click the mouse, a corresponding event occurs. These are caused by the event-driven properties that Windows has. For example, when you press the word keys of the keyboard, Message Queuing sends a WM_CHAR message to the program, and if you write a program that contains a function to handle the message, the program executes it.
To better understand Windows programming, here are a few basic concepts I have to introduce:
1, handle: It is the foundation of Windows programming. A handle is a unique integer that Windows uses in memory and is a 4-byte number that identifies different instances of different objects and objects in the application.
Here I list several Windows-common handles:
HWND: Mark Window Handle
HINSTANCE: Mark current instance handle
Hcoursor: Mark cursor handle
Hfont: Label Font handle
Hpen: Mark Brush handle
Hbrush: Mark Brush handle