Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a normal win32 edit control?

Tags:

c

winapi

I'm trying to create an edit control with the regular 3D border around it (in the classic windows style, anyway), but it just has a 1px black border around it. Here is my CreateWindowEx call:

return CreateWindowEx(0, "EDIT", "E:\\bk",
                      WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
                      87, 81, 150, 17,
                      main_window.hwnd,
                      (HMENU)5, hInstance, NULL);

If I exclude WS_BORDER then it's just a white box. Any ideas on what's wrong here?

Update

WS_EX_CLIENTEDGE did the trick. I don't know anything about manifest files, or how to make the window use the more modern windows themes (XP, for example), instead of the chunky 3D borders. But, when I do learn all that, will WS_EX_CLIENTEDGE make them use those themes instead, or will it enforce the 3D look?

like image 576
Carson Myers Avatar asked Dec 23 '22 11:12

Carson Myers


2 Answers

Try using WS_EX_CLIENTEDGE. That will create an inset 3-D window border under typical situations.

return CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "E:\\bk",
                      WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
                      87, 81, 150, 17,
                      main_window.hwnd,
                      (HMENU)5, hInstance, NULL);

Also see the following link for the rest of the available flags for CreateWindowEx.

CreateWindowEx at MSDN

like image 62
meklarian Avatar answered Dec 28 '22 08:12

meklarian


He is right WS_EX_CLIENTEDGE will do the 3D border.

like image 40
Kornalius Avatar answered Dec 28 '22 09:12

Kornalius