This is really just for education on the nuances of MFC.
I was playing around with creating windows of different sizes and positions. Although I can achieve this with SetWindowPos, I have tried a number of times with CREATESTRUCT but it has only worked once for me.
In all other projects, I can change the style but not the position and size. The only thing I can imagine is that ia dependent on the initial MFC project set-up and what underlying Application is picked. I have experiment but still can't find one that allows the above code to work again. Am I missing something really obvious.
As I said I can affect the changes through SetWindowPos but I would like to understand why CREATESTRUCT doesn't always work. I would also be gratefully if someone could explain when you would consider changing the code in:
I have now tried on numerous different Application set-ups and the only set-up that seems to allow sizing and position through CREATESTRUCT is when User Interface Features - Use Classic Menus is selected. My original code then works. This makes me think that selecting menu bars, toolbars or ribbons forces some later automatic sizing to occur after the PreCreateWindow.