Is there a win32 function to change the style of a window after it has been created? I would like to change the style flags that are specified in CreateWindowEx
. Specifically, I would like to convert a standard window to a window with no border and no resize.
GWL_WNDPROC -4. Sets a new address for the window procedure. You cannot change this attribute if the window does not belong to the same process as the calling thread. The following values are also available when the hWnd parameter identifies a dialog box.
WS_TABSTOP. 0x00010000L. The window is a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style. You can turn this style on and off to change dialog box navigation.
Creating a Main Window Most applications typically use the WS_OVERLAPPEDWINDOW style to create the main window. This style gives the window a title bar, a window menu, a sizing border, and minimize and maximize buttons. The CreateWindowEx function returns a handle that uniquely identifies the window.
I think SetWindowLongPtr
should do that. Note that you need to call SetWindowPos
afterwards if you changed the border style, as pointed out in the remarks.
Some styles only take effect during window creation and so can not be set by this call. MSDN normally calls out styles that CAN be set afterwards.
HWND windowHandle = FindWindow(NULL, L"Various tests");
SetWindowLongPtr(windowHandle, GWL_STYLE, WS_SYSMENU); //3d argument=style
SetWindowPos(windowHandle, HWND_TOPMOST, 100, 100, Width, Height, SWP_SHOWWINDOW);
did it for me :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With