Question

I created an edit control by the following code:

hWnd = CreateWindowExW( 0,      // extended styles
                        L"EDIT",
                        L"Text in edit.",
                        ES_LEFT | WS_VISIBLE | WS_CHILD,
                        10,     // x
                        50,     // y
                        30,     // width
                        100,    // height
                        hWndMainWindow,
                        NULL,
                        hInstance,
                        NULL);

My edit control looks like this:
My edit control

But most edit controls I see in Windows have a 3D look like in the image below:
Normal edit controls

I tried several extended and normal window styles, but the didn't do any good. How do I make my edit control look like in the second image?

Some quick links that may help you to take reference:
Window Styles
Extended Window Styles
Edit Styles

Was it helpful?

Solution

You need to include the WS_EX_CLIENTEDGE extended window style.

You say that you have already tried including WS_EX_CLIENTEDGE without success. I'm going to take a wild guess that you have been trying to include it in the window style rather than the extended window style. Your code should look like this:

hWnd = CreateWindowExW( 
    WS_EX_CLIENTEDGE,  // extended styles
    L"EDIT",
    ...
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top