5
votes

I'm using CreateWindowEx to create an Edit control (a textbox), but saying CW_DEFAULT doesn't help with getting the default height of the textbox -- it just makes a window with a height of zero.

How do I get the system-default size of a textbox, so I can turn Edit control into a normal-looking textbox?

1
That is the documented behavior: "if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameters are set to zero.". So CW_USEDEFAULT is definitely the wrong approach. - Ben Voigt

1 Answers

11
votes

The recommended size is 14 dialog units. Here is the reference

You can use MapDialogRect to convert dialog units into pixels.