Window
Each GUI application has a window that consists of multiple parts. Includes title bar, [A1] menu bar, customer area [A2], status bar, etc.
is the dialog box a window or a control?
Window class
Each window corresponds to a window class. The window class defines menu items, backgrounds, icons, mouse pointer styles, and window message handler functions. each window class corresponds to a message handler function , that is, each window has its own message handler function.
Before the application creates a window, it is necessary to register the window class with the system, or use a window class that is already defined by the system.
Message and Message handler functions
- Message classification: COMMAND and Wm_, and a type of notification message, as well as a control message?
Control
Control, which is actually a special kind of window, is a child window.
Windows controls are divided into user controls (user control) and common controls (universal controls)
Windows the control is placed in another dynamic library. such as:ComCtl32.dll
Applications can use these controls directly without having to redefine them.
There are many types of controls, commonly used include:
text Box (Edit, RichEdit),
button (Button,check boxes,group boxes,push buttons,radio Buttons) ,
Drop -down menu (ComboBox) ,
ListBox (list box) ,
grouped lists (list View) ,
Paging (Pager) ,
progress bar (process bar) ,
Properties page (property Sheet),
Work bar (ToolBar),
Trees (Tree View )
controls have specific window styles, realistic settings, and message-handling procedures. You do not need to do message processing when using controls.
Resources
Resources are some of the data, markers, bitmaps, menus, and so on that the application may use in the run.
When programming, developers can configure resources in a resource script (. rc), and when the program is built, the resource compiler compiles the resource into a resource file (. res), which is then linked by the linker to the executable file. These resources can be used by programs while they are running.
Gdidevice Context (DC)
A DC is a structure that defines the properties of graphical objects and graphical objects , in graphical mode .
Drawing objects include brushes , brushes , Fonts , bitmaps , palettes (Palette), regions ( rectangles ) , etc./
These objects can be selected into the DC using the SelectObject () function.
Overloads the SelectObject () method to accept pointers to various types of objects.
Drawing modes (Graphic mode)
Windows supports 5 graphics modes, allowing the application to specify: 1. How colors are synthesized. 2. Where does the output appear
- How the output is scaled, etc.
The mode is stored in device Context (DC).
5 modes are:
- BACKGROUND[A3]
- DRAWING[A4]
- MAPPING[A5]
- POLYGON-FILL[A6]
- STRETCHING[A7]
Create dialog box
Method:
- Using Resources to create dialog boxes, you can use API macros or functions such as createdialog, Createdialogparam, DialogBox, Dialogboxparam, and so on.
- To create a dialog box without relying on resources, you can use:
Createdialogindirect, Createdialogindrectparam, Dialogboxindirect,
Dialogboxindirectparam and other API macros and functions create dialog boxes directly.
dialog box Message handler function:
When you create a dialog box, you need to indicate the dialog message handler function.
Returns TRUE if a message can have a message handler function for a dialog box
[A1] Includes Application icon, window caption, maximize, minimize, close button.
The [A2] customer area is used to place the window's function space, real content and so on.
[A3] defines how screen colors for existing window or bitmap and text operations are synthesized
[A4] corresponds to background, drawing is a foreground color definition.
[A5] defines how the output graph maps from a logical space to a window, screen, or printer paper
[A6] Defines the brush pattern, how to populate the interior of complex areas
[A7] defines how bitmap colors are synthesized