Types of Window Classes
Window Classes – Part 1
Volume - Windows User Interface
Forward: This is the first part of the series where we learn the details of window classes. We start with the different types of classes.
By: Chrysanthus Date Published: 29 Aug 2012
Introduction
The application language used in this division is C++.
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
Prerequisite
You need to have knowledge in the following before reading this tutorial (and the volumes):
- Getting to know Windows
“Getting to know Windows” is a tutorial series. To reach the series, just type the title and my name Chrys in the Search Box of this page and click Search. You can use hyperlinks on this page to arrive at the other parts of this series and to arrive at the Windows API Tutorial Set page.
What is a Class?
A window class is a collection of characteristics (attribute) for one or more windows. To create a class, you have to type the attributes in the WNDCLASSEX struct; then you register the class (struct).
Module
A module, usually existing as a library (.dll), is a set of common functions that many applications can use.
A Process
A process is an instance of a computer program (application) that is being executed. Imagine that you start your text editor (or word processor) and it is on (running). That is a process. If you go on to start another application and it is running, it would mean you have two processes running.
A thread
A thread is like a process inside a process. The running time of a thread can be very short. You can have more than one thread running at the same time in a process. So if you start an application, which is a process, two tasks can be done at the same time. These two tasks are threads. There are technical differences between a process and a thread, but I will not go into that.
There are three types of window classes. A class can be for a thread or a process. The word, Scope refers to whether a class is for threads or processes. The three types of classes differ in scope and in when and how they are registered and destroyed. The three types of classes are called, System Classes, Application Global Classes and Application Local Classes. A process has at least one thread.
The System Class
A System Class is a window class that the system (operating system) registers. Some system classes are used only by the system, while many others are used by all processes (applications). A process cannot destroy a system class because it is registered by the system. The same system class (copy) can be used by different processes (applications).
Application Global Class
An Application Global Class is a window class that a module registers and the class is available to all other modules in the process. So a library (.dll) can use the RegisterClassEx function to register a class so that a process (application) that loads the library (.dll) can create instances of the class. This registered class will be available to the other libraries that the process loads.
The UnregisterClass predefined function can be used to destroy an application global class and free the storage memory associated with it.
An application local class is any window class that an application or library registers for its exclusive use. The main window class belongs to this category. In theory, an application can register any number of classes, however, it is typical to register only one. This window class works with the window procedure of the application's main window.
When the module or application that registered the class closes, the system destroys the local class. An application can also use the UnregisterClass function to remove a local class and free the memory storage associated with it.
Available System Classes
System classes are in two groups: the group that any process can use and the group that only the operating system itself can use. I will give you the two groups here; their descriptions are copied from the manual. You will not understand the descriptions now. However, as we go along in the volume I will explain them. The reason I am giving you is because you need a reference of them. Here they are:
System classes that any process can use are:
Button: The class for a button.
ComboBox: The class for a combo box.
Edit: The class for an edit control.
ListBox: The class for a list box.
MDIClient: The class for an MDI client window.
ScrollBar: The class for a scroll bar.
Static: The class for a static control.
System classes that only the operating system can use are:
Class Description
ComboLBox: The class for the list box contained in a combo box.
DDEMLEvent: The class for Dynamic Data Exchange Management Library (DDEML) events.
Message: The class for a message-only window.
#32768: The class for a menu.
#32769: The class for the desktop window.
#32770: The class for a dialog box.
#32771: The class for the task switch window.
#32772: The class for icon titles.
We shall see details of the System Classes and the Application Local Classes as we go along. Let us stop here and continue in the next part of the series.
Chrys
Related Courses
C++ CourseRelational Database and Sybase
Windows User Interface
Computer Programmer – A Jack of all Trade – Poem
NEXT