MFC text box

hello
I am a beginner to MFC and
I am building an application on MFC dialog
i want two text box on the dialog
The first text box can be edited and the second one is read only mode
I want the Data of the first text box entered to be copied to the second one and displayed on the click of the button
Can any one provide me with the code for this???
Last edited on
Hey i managed to search the answer on google...
I'm not entirely sure if it's what you want, but if you want an editable text box you can rename your classname to "EDIT".
You can use the CreateWindowEx() function provided with the Win32 API.
Here is an example of how can you implement it easily:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
HWND hctrl;
...
        case WM_CREATE:
           hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
           hctrl = CreateWindowEx(
              0,
              "EDIT",          /* Class Name*/
              "",              /*This is the text, it's empty*/
              ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, /* Style */ 
              36, 20,          /* Position */
              120, 20,         /* Size */
              hwnd,            /*Parent Window*/
              (HMENU)ID_TEXT, /* Control identifier, defined in the resource file*/
              hInstance,       /* Instance */
              NULL);           /* Window creation data*/ 
           SetFocus(hctrl);
           return 0;

Topic archived. No new replies allowed.