[Mwinapi-commits] SF.net SVN: mwinapi:[130] trunk/ManagedWinapi/Windows/SystemWindow.cs
Status: Beta
Brought to you by:
schierlm
From: <zi...@us...> - 2015-07-07 15:14:55
|
Revision: 130 http://sourceforge.net/p/mwinapi/code/130 Author: ziewer Date: 2015-07-07 15:14:52 +0000 (Tue, 07 Jul 2015) Log Message: ----------- improved SystemWindow.TopMost setter: do not activate window when (un)setting topMost state Modified Paths: -------------- trunk/ManagedWinapi/Windows/SystemWindow.cs Modified: trunk/ManagedWinapi/Windows/SystemWindow.cs =================================================================== --- trunk/ManagedWinapi/Windows/SystemWindow.cs 2015-02-04 20:28:10 UTC (rev 129) +++ trunk/ManagedWinapi/Windows/SystemWindow.cs 2015-07-07 15:14:52 UTC (rev 130) @@ -572,11 +572,11 @@ { if (value) { - SetWindowPos(_hwnd, new IntPtr(-1), 0, 0, 0, 0, 3); + SetWindowPos(_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } else { - SetWindowPos(_hwnd, new IntPtr(-2), 0, 0, 0, 0, 3); + SetWindowPos(_hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } } } @@ -1390,6 +1390,21 @@ private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + // special values for hWndInsertAfter + static readonly IntPtr HWND_BOTTOM = new IntPtr(1); + static readonly IntPtr HWND_TOP = new IntPtr(0); + static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); + static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); + + // window sizing and positioning flags + const uint SWP_NOSIZE = 0x0001; + const uint SWP_NOMOVE = 0x0002; + const uint SWP_NOACTIVATE = 0x0010; + const uint SWP_DRAWFRAME = 0x0020; + const uint SWP_SHOWWINDOW = 0x0040; + const uint SWP_NOOWNERZORDER = 0x0200; + const uint SWP_ASYNCWINDOWPOS = 0x4000; + [DllImport("user32.dll")] private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |