"Windows programming" learning notes (1)

zhaozj2021-02-16  50

The first chapter begins

In actual development, whether we use what language and development tools to develop software development, learn and use Windows Application Programming Interfaces (APIS) provided by Windows itself, because the API provides us with everything, no What method is more than the use of APIs directly. Using the API is implemented by calling a function in the Dynamic Library (DLL), in Windows, the API mainly has three dynamic connection library Kernel, User, GDI. KERNEL: Handling all transactions processed by Windows kernels - memory management, file I / O, and task. User: Refers to the user interface and implements all window logic. GDI: It is a graphics device interface that allows the program to display text and graphics on the screen and printer. These three dynamic connection libraries can be found in the directory of Window2000 / WinNT / System32: kernel32.dll, user32.dll, gdi32.dll.

There are still thousands of API functions in Windows, and Microsoft is still updating, so learning API programming first is to understand basic concept principles, then learn to use Microsoft's MSDN (Microsoft Developer Network: Microsoft Developer Networks) Looking for something you need. This book is to learn the role of understanding the basic concept principle.

This chapter mentioned several commonly used basic concepts, be sure to remember: 1, API (Application Programming Interface): Application Programming Interface 2, GUI (Graphical User Interface): Graphical User Interface 3, Wysiwyc (What You See What You GET): WYW 4, GRAPHICS Device Interface: Graphics Device Interface 5, DLL (Dynamic Linking Library): Dynamic Library

The book gives an example to initially experience the Windows API programming. The following code can pop up a message window displaying "Hello, Windows 2000!": #Include

Int WinApi Winmain (Hinstance Hinstance, Pstr Szcmdline, int icmdshow) {MessageBox (NULL, TEXT ("Hello, Windows 2000!"), Text ("Hellomsg"), 0);

Return 0;}

The WinMain function is the entry point where the Window program is running. WinMain's first parameter is called "Example Handle", which is used to uniquely identify a number of the application instance. The second parameter is now no longer, set to null. The third parameter is the command line for running the program. In the CSDN Library, it indicates that Szcmdline is not Unicode Strings, and if you want to get the unicode strings, you can use the getcommandline function. The third parameter indicates the way the program is originally displayed. The definition of the WinAPI identifier is: #define WinAPI __stdcall, __stdcall refers to a way to access the Window call function, which is how to access function parameters in the heap. Many Windows API function calls declares that __stdcall mode, as for why I don't know now.

转载请注明原文地址:https://www.9cbs.com/read-28252.html

New Post(0)