WS_EX_NOACTIVATE dragging/resizing bug

Skip to first unread message

Robert Phillips

Nov 22, 2017, 4:42:25 PM11/22/17

I don't know much about win api, I am using C# but others have run into this with visual c++.


The issue is that in Windows 7, when a window is made such that it can't be made active, with WS_EX_NOACTIVATE, then when you try to move it nothing gets redrawn while the mouse is moved to drag it.

The window just shows in its original location, and when the mouse button is released, it shows in its new location.

In my C# program,

It happens if I put this in a form class, and it happens with either a WPF form or a winforms form, though i'm more interested in winforms.

I don't want the form to activate, but I do want the window or border of the window to redraw when dragged(based on the win7 "show window contents while dragging" checkbox. Win7 has an option "show window contents while dragging", if enabled it redraws the window, if disabled it redraws just the border. Unfortunately when I try the code below, I get nothing redrawn.

private const int WS_EX_NOACTIVATE = 0x08000000;
protected override CreateParams CreateParams
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= WS_EX_NOACTIVATE;
return createParams;

Reply all
Reply to author
0 new messages