Reputation: 14085
I want my console window to be modified. I got the handle. And this helps to change it. But how can I
?
// C# syntax
StringBuilder buffer = new StringBuilder(260);
IntPtr window = FindWindow(null, buffer.ToString(0, GetConsoleTitle(buffer, buffer.Capacity)));
uint a = (uint)((WS_BORDER | WS_CAPTION) & (~WS_ICONIC));
SetWindowLongPtr(window, -16, new IntPtr(a)); // GWL_STYLE = -16
For some reason the window is broken after this call. I can't move it with the mouse anymore and all clicks go through it to other windows.
Upvotes: 1
Views: 285
Reputation: 613451
You removed all the window styles, and added back just WS_BORDER
and WS_CAPTION
. What you should do is:
GetWindowLongPtr
.AND
with the bitwise negation of the styles you want to remove.SetWindowLongPtr
.Upvotes: 2