Primary Windows API C + + language programming (1)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.