The desktop Window is
When you enter the Windows system, you can see the desktop Window. A desktop Window is a system-defined Window that can hold Windows created by other applications.
The background image of the desktop Window is a BMP file. This BMP file should be stored in a secure location, if deleted, the desktop Window background will be dark. This is because the Windows system records the location of the BMP file in the registry and reads the location of the BMP file from this registry key every time the background of the desktop Window is rendered (for example, during a restart). If you can’t find it, the natural desktop Window is completely dark.
You can use the Win32 method of GetDesktopWindow to get a handle to the desktop Window in order to perform the desired operation.
If you want to modify the desktop background, you can use the Win32 method of SystemParametersInfo.
The form is the Window
The Windows form structure is shown below:
Anyone who has ever used Windows can see what each component does.
In addition, the pop-up start menu is also Window; Even the Windows taskbar is a combination of several Windows.
In short, everything you see is Windows.
The attribute of the Window
Each Window has the following properties
The name of the class
The window name
Extended window style
Handle to a parent or child form
The handle to a menu or the identity of a child form
Handle to the instance
Handle to the window
There are five types of Windows in the system.
The top Window
The popup window
The child window
A layered Window
Windows that process only messages
The system can send messages directly to a child window, but not through its parent window. In C#, inter-window operations are often performed using the p-invoke feature.
A message-only Window can only send and receive messages. It is invisible, has no z-axis hierarchy, cannot be enumerated, and cannot receive broadcast messages.
Window creation process
Every window-based application has an entry point (entry function). The entry function does two things
Register the window and call the RegisterClass method
Create a window and call the CreateWindowEx method
Once created, the created window does not display itself. Therefore, you also need to call the display method (ShowWindow) to display.
If you have experience with Winform or Win32 development, this process is not difficult to understand.
Window destruction process
To destroy a window, simply call the DestroyWindow method.
When a window is destroyed, the window disappears and the resources associated with it are reclaimed.
If a window has a close button. When clicked, the form receives a Windows message named WM_CLOSE. You can optionally add a confirmation close action when this message is received. Then decide whether to call the DestroyWindow method based on the case.
Post time: Apr-21-2022