Win32 API(Application Programming Interface)
Win32 API can be thought of as a library, offers a variety of functions related to the windows system service.
Win32 API is the lowest level of service, you can call the Windows services.
SDK programming is commonly referred to directly call API functions for programming.
Win32 API refers to a set of functions used in the preparation of the 32-bit application, structure, macro definitions. In the Win32 environment, in any language it is built on the basis of the Win32 API. C # API software hidden deep.
Most are located in three core API DLL in
kernel32.dll、user32.dll、GDI32.dll
Using it to develop windows applications too cumbersome.
API&MFC
1、kernel
In Win32 library named KERNEL32.DLL, mainly for the association between generation and operating system.
Loader
Select context
File Input Output
Memory Management
For example: GlobalMemoryStatus function is, including current physical memory and virtual memory usage information.
2、user
This library named in Win32 USER32.DLL
It allows the management of all user interface. E.g
window
menu
Dialog
Icons and so on.
For example, DrawIcon function will "paint" the mouse on the icon or associated with the specified device.
3、GDI(Graphical Device Interface)
It is named Win32 library GDI32.dll, it is a graphical output library, using GDI Windows "draw" out of windows, menus, and dialog boxes;
It can create graphical output
It can also save graphics files.
For example, the CreateBitmap function can create a bitmap in a specified length, width and color.
4、API&MFC
API: a set of functions used to control the various components of Windows (from the appearance of the desktop to the memory allocated for a new process) the appearance and behavior of a set of predefined Windows.
MFC: is the encapsulation of the Windows API, is a combination of Win API for C ++, MFC is hanging over one of its supporting software development kit.
MFC's main include file for the "Afxwin.h"
The main API include file is "windows.h"
API function calls the method
1, C ++ calling process
(1) contains the file you want to call the function declaration
windows.h include other header files
windef.h base type definition
winnt.h support of Unicode type definition
winbase.h kernel function
winuser.h user interface functions
Graphics Device Interface function wingdi.h
winsock.h network programming function
(2) connected to the specified library file
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
Explicitly set #pragma comment (lib, "WS2_32.lib")
(3) plus "::" indicates that this is a global function, C ++ member function with the class distinction before API function.
Examples of API calls (C ++)
#include "stdafx.h" // This is a VC automatically add the header files, mainly speed up compilation #include <windows.h> // MessageBox function declaration contains the header file int main (int argc, char * argv [] ) {// call the API function MessageBox int nSelect = :: MessageBox (NULL , "Hello, Windows", "Greeting", MB_OKCANCEL); if (nSelect == IDOK) printf ( " the user selects the" OK "button \ n" ); else printf ( "the user selects the" cancel "button \ n"); return 0; }
description link: https: //blog.csdn.net/qq_32285693/article/details/95061363