Calling APIs in C #

Source: Internet
Author: User

Introduced

API (Application Programming Interface), I think we will not be unfamiliar, it is our Windows programming regulars, though based. NET platform, C # has a powerful class library, but we still can't deny the importance of APIs in Windows programming. Most programming languages support API programming, and the MFC (Microsoft Foundation Class Library) architecture in the. NET platform encapsulates most of the APIs.

As programmers, we need to understand that the API is literally a programming interface, so as a developer, what you need to know is how the API is used.

The API has many different types depending on the operating system, processor, and functionality. Operating system-specific APIs:

Each operating system has a number of common APIs and some special APIs that can only be executed in the current operating system.

For example:

Windows NT supports MS-DOS, Win16, Win32, POSIX (Portable operating System Interface), OS/2 console API; Windows 95 supports MS-DOS, Win16, and Win32 APIs.

Win16 & Win32 API:

The Win16 is developed for 16-bit processors and is supported by early operating systems.

Win32 is developed for 32-bit processors. It is highly portable and is supported by most processors.

The Win32 API has a "32" suffix after the library name. such as Kernel32,user32 and so on.

All APIs run in the following 3 libraries:

  Kernel
  User
  GDI

1. KERNEL

His library name is KERNEL32. DLL, which is used primarily to produce an association with the operating system:

Program loading

Context selection.

file input and output.

Memory management.

For example, the GlobalMemoryStatus function includes the current physical memory and virtual memory usage information.

2. USER

This class library is named USER32 in the Win32. Dll.

It allows you to manage all the user interfaces, such as:

Window

Menu

dialog box

icons, and so on.

For example, the DrawIcon function will "draw" an icon or mouse on the specified device association.

3. GDI (graphical Device Interface)

Its library name in Win32 is: GDI32.dll, which is the graphics output library. Use GDI windows "draw" out windows, menus, and dialog boxes:

It can create graphics output.

It can also save graphics files.

For example, the CreateBitmap function creates a bitmap from the specified length, width, and color.

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.