Reputation: 574
int width=640, height=480;
RECT rect{0,0,width,height};
const DWORD style = WS_VISIBLE|WS_OVERLAPPEDWINDOW;
AdjustWindowRect(&rect,style,false);
auto hwnd = CreateWindowA("listbox","test",style,CW_USEDEFAULT,CW_USEDEFAULT,rect.right-rect.left,rect.bottom-rect.top,nullptr,nullptr,nullptr,nullptr);
The client rectangle is 640x473. What did I do wrong?
Upvotes: 2
Views: 385
Reputation: 33734
when you use List Box control the result height is depend from LBS_NOINTEGRALHEIGHT
style:
Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, the system sizes a list box so that the list box does not display partial items.
so without this style, default List Box window procedure resize window, for not display partial items
Upvotes: 2