Learning notes-how Windows programs run

Source: Internet
Author: User

The operating system provides the functions it can accomplish to the application in the form of functions.ProgramApplication calls to these functions are called system calls. The collection of these functions is the Application Programming Interface (Windows API) provided by the Windows operating system for application programming.

The operating system packs each event into a message struct MSG to pass to the application,
The MSG structure is defined as follows:
Typedef struct tagmsg {
Hwnd;
Uint message;
Wparam;
Lparam;
DWORD time;
Point pt;
} MSG;

Handle
Handle, the resource ID.
The operating system needs to manage and operate these resources by using handles to find the corresponding resources. By resource type, you can also subdivided the handle into the icon handle (hicon), the cursor handle (hcursor), the window handle (hwnd), and the application instance handle (hinstance) and other types of handles. The operating system specifies a unique identification number for each window, that is, the window handle.

Winmain Function
Entry functions of Windows programs
Int winapi winmain (
Hinstance, // handle to current instance
Hinstance hprevinstance, // handle to previous instance
Lpstr lpcmdline, // command line
Int ncmdshow // show state
);

Window Creation
To create a complete window, follow these four steps:
Design a window class;
Registration window class;
Create window;
Display and update window.

Typedef struct _ wndclass {
Uint style;
Wndproc lpfnwndproc;
Int cbclsextra;
Int cbwndextra;
Handle hinstance;
Hicon;
Hcursor;
Hbrush hbrbackground;
Lpctstr lpszmenuname;
Lpctstr lpszclassname;
} Wndclass;

 

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.