I want to create a function (if there isn't one already) that'll resize a window when given its handle, new width and new height...
Simple enough surely?
Also I'd like to create a function which can easily change the styles of window from fullscreen (WS_EX_TOPMOST | WS_POPUP), to standard (WS_OVERLAPPED or WS_OVERLAPPEDWINDOW)...
Todo so would also need style value in the window handle and summat in DirectX but I'll deal with that one later.
So the question simplified is how to I alter members of the window using the handle when the window is assigned to the handle using CreateWindowEx(...)
You can change some of the style using GetWindowLongPtr/SetWindowLongPtr with GWL_STYLE (and the extended style using GWL_EXSTYLE)
- Some of the bits should be modified using the appropriate API call, e.g. the WS_VISIBLE should normally be handled using ShowWindow()
- But some of the bits only mean something when the window is created. For example, I'm not sure what happens if you change the WS_CHILD bit after creating a child window. This might well be ignored, but if it is allowed it could cause confusion!
- In some cases you might have to call SetWindowPos before the window responds to the change (ATL's CWindow::ModifyStyle() method calls GetWindowPos, SetWindowPos and then SetWindowPos)
Note that GetWindowLongPtr should be used rather than the older GetWindowLong which is still referred to some older documentation. Similarly with the corresponding set function.