Refresh foreign form after setting CS_DROPSHADOW

  • Thread starter Thread starter vbtricks.de.vu Webmaster
  • Start date Start date
V

vbtricks.de.vu Webmaster

Salut,

I'd like to write a small tool that focuses the currently foreground
window using the CS_DROPSHADOW attribute to the window's class.

Setting and removing the attribute works fine, the only issue left to
solve is that the window is not redrawn. As the shadow is not in the
window's rectangle sending a refresh-command did not work, SetWindowsPos
failed as well (see below). Hiding and showing the window again works,
but it causes the taskbar to hide and show the button for the window.

How to refresh the window without flickering?

private void EnableDropShadow(IntPtr window, bool DoEnable)
{
int classLong = GetClassLong(window, GCL_STYLE);
if (DoEnable)
{
classLong = classLong | CS_DROPSHADOW;
}
else
{
classLong = classLong & ~CS_DROPSHADOW;
}
SetClassLong(window, GCL_STYLE, classLong);
SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
SWP_NOZORDER | SWP_FRAMECHANGED);
}


Thanks in advance,

Stefan

--
__________________________________________________www.vbtricks.de.vu
the free resource for Visual Basic 6, C# and VB.net components,
tips & complete projects

www: http://www.vbtricks.de.vu/
mail: vbtricks <at> gmx <dot> net

openpgp key:
http://vbtricks.vb.funpic.de/index.php?permalink=20000101-Imprint
____________________________________________________________________
 
Back
Top