Implementing Edit Controls
Introduction
Welcome back to Interactive Controls and Layouts. We are now in Lesson 2, and our application is starting to feel much more like a real desktop program. In the previous lesson, we placed a label and a button inside the main window. In this lesson, we will connect those two pieces with something essential: an Edit control.
By the end of this lesson, we will know how to create an Edit control, give it its own identifier, and style it so it looks like a proper input box. This is a very practical step, because once a program can accept typed text, it can start collecting names, search terms, messages, and many other kinds of user input.
Why The Edit Control Matters
A label can show information, and a button can trigger an action, but neither one can hold text that the user types. That is the role of the EDIT control. It is the standard WinAPI text box, and Windows already knows how it should behave, so we can create it by using the built-in system class name EDIT.
It helps to think of this control as a familiar input field from everyday apps. A search box, a login form, and a chat window all rely on text entry. In WinAPI, we add that same ability by creating another child window inside WM_CREATE. The interesting part is not just making it appear, but choosing styles that make it pleasant to use.
Adding A New Control Identifier
Before we create the new input field, we extend the list of control IDs. As we may recall from the previous unit, these IDs help us tell one child control from another. They become especially useful once we want to read the text later.
There are two things worth noticing here. First, #include <windows.h> still gives us access to all WinAPI types, messages, and functions. Second, ID_EDIT_INPUT is the new piece in this lesson. We assign it the value 103, which keeps it distinct from the label and the button. That unique value gives the text field its own identity inside the window, so later code can refer to the correct control without guessing.
Returning To The Creation Stage
