Win32 programming (Windows programming mechanism)

Source: Internet
Author: User

Win32 programming is often called SDK/API programming. Currently, there are very few programmers using Win32, mainly because it is more difficult to write code with win32 than using vc, however, Win32 programming is often very efficient. Currently, many of them are used in programming games. many people complain that VC is too difficult to learn. It is a bit difficult for tigers to take a day, and they do not know how to get started. Some people even haven't gotten started for a year or two, if you have such a feeling, it is better to read relevant information about the Win32 SDK first. I think it will be of great help to you. I will not write this article below, I wrote it by my master. Later, I used the object-oriented idea of MFC to encapsulate SDK structured programs, but I have never summarized it, I will make up some time !!!!

 

Basic concepts of Windows Programming
 

Program Design: Based on the resources of the operating system and language system, the network and database technology are used to address the professional needs of the problem. In accordance with the software engineering specifications, the syntax mechanism of the language system is used, describes the process of solving the problem. Operating system resources, language system resources, network technology, database technology, professional requirements, software specifications and syntax rules are called seven elements of the program design logic. Generally, the so-called C ++ programming, Fortran programming, PASCAL programming, etc. are the basic syntax rules and programming methods of programming from the perspective of syntax; the so-called VC ++ program design is in line with the above-mentioned program design ideas, mainly from the perspective of operating system resources using language system resources for program design, we need to have a good knowledge of the C ++ object and a thorough understanding of Win32 API resources. Our current Windows program design is from the perspective of operating system resources, this is the most essential learning of Windows professional program development, and is the most powerful start from non-professional to professional.

Win32 API: If you compare an operating system to a software building, Win32 API is used to build a 32-bit Windows operating system (Windows 9x, Windows NT, Windows 2000, Windows me, Windows CE, and Windows XP) premade parts, it is an interface used by Microsoft to develop software for its 32-bit operating system platform and for operating system resources provided by software developers, or Application programming interface ), the fields covered include: windows system management, system information, system security, process, thread, dynamic link, memory management, file system, keyboard and mouse input, GDI object, network communication, resource management, printing, Program debugging and exception handling. They exist in the operating system in the form of dynamic link libraries for the operating system and Win32 applications to call.

Win32 platform: a platform that supports Win32 application programs, such as Win32S, Windows 9x, Windows NT, Windows 2000, Windows me, Windows CE, and Windows XP, if the Win32 application is compared to a CD music disc, the CD platform is CD Walkman, VCD player, and DVD player.
 

Task: the application running on the operating system, that is, the task executed by the operating system.

Multi-task: execute multiple tasks in the same time period, that is, multi-task. Windows 3. x is a collaborative multi-task operating system; 32-bit Windows is a time-based multi-task operating system based on process and thread priority.

Process: the operating system constructs tasks and allocates resources. It can also be understood as the basic unit of the operating system for task execution, scheduling, and resource allocation. It is a collection of program code, data, and resources, resources include address space resources, CPU time resources (threads), memory resources, file resources, communication resources, and display resources. The code, data, and resources of Win32 applications are distributed in a 4 GB address space. The operating system runs the thread resource driver allocated to the process, and the program runs in the memory.

Thread: the mechanism of the operating system-driven process is the thread. It can also be understood as the CPU time resource allocation unit of the operating system. It is the running of the thread-driven process. An operating system can run multiple processes at the same time, and a process can have multiple threads. Processes and threads have priority. Win32 applications implement preemptive multi-task through priority-based multi-process and multi-thread mechanisms. This level of preemptive capabilities is given by the priority of processes and threads.

Events: in a broad sense, actions and operations occur in computer systems; in a narrow sense, operating systems and users are applied to software objects (tasks in a broad sense can be understood as tasks, in a narrow sense, it can be understood as a software window object.

Message: The program description of the event is a message. The Message description in the program is similar to the event log in daily work. It describes the events of the day in terms of time, location, character, event, and reason; from another perspective, messages are commands that drive window object actions. In general, messages can be divided into user messages, control messages, system messages, and program messages.

Message Queue: A list of user and operating system actions and operations on software objects. The operating system creates a message queue for window objects created by the thread in units of threads, messages related to a window object. The operating system sends messages to the Message Queue of the thread that creates the window object.

Message loop: The process of Retrieving messages from a message queue.

Window object: a visible rectangular area on the screen that can accept and process operating systems and user-applied operations and actions, it is a mechanism by which interactive programs are constructed by an operating system based on graphical objects.

Window class: program description of the same type of window object. wndclass structure is used to describe properties and window process is used to describe behavior. To create a window object, you must first successfully register the window class with the operating system.

Window Process: A window object processes events and messages, that is, a window function. All the behaviors and functions of a window object are defined in the window process.

Handle: A 32-bit unsigned integer. It can be identified by handle. Here, Win32 objects are such kernel objects (process object hprocess, thread object hthread, file object hfile, file ing object, mail slot object, event object, semaphore object, and mutex object) gui objects (window objects hwnd, menu objects hmenu, cursor objects hcursor, icon objects hicon, etc.), GDI objects hgdiobj (HDC, Hpen, hbrush, hfont), etc, there are many more!

Address: http://old.blog.edu.cn/user2/lichangpo/archives/2006/1298419.shtml

Related Article

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.