Solved

Equivalent to setting TopMost = false

Posted on 2007-12-05
2
523 Views
Last Modified: 2013-12-16
Hello,

I'm using this code attached within the question (taken from http://www.codeproject.com/KB/vb/SnapForm.aspx) and I'm wondering if:

SetWindowPos (this.Handle, HWND_TOPMOST, Left, Top, Width, Height, SWP_NOACTIVATE);

Is equivalent to setting TopMost = true... What is the equivalent to setting TopMost = false?

Thanks.
const Int32 HWND_TOPMOST = -1;
const Int32 SWP_NOACTIVATE = 0x0010;
const Int32 SW_SHOWNOACTIVATE = 4;
[DllImport ("user32.dll")]
protected static extern bool ShowWindow (IntPtr hWnd, Int32 flags);
[DllImport ("user32.dll")]
protected static extern bool SetWindowPos (IntPtr hWnd, 
  Int32 hWndInsertAfter, Int32 X, Int32 Y, Int32 cx, Int32 cy, uint uFlags);
 
// Show the window without activating it.
 
ShowWindow (this.Handle, SW_SHOWNOACTIVATE);
 
// Equivalent to setting TopMost = true, except don't activate the window.
 
SetWindowPos (this.Handle, HWND_TOPMOST, Left, Top, Width, Height, SWP_NOACTIVATE);

Open in new window

0
Comment
Question by:EEssam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 20415145
0
 
LVL 40

Accepted Solution

by:
evilrix earned 500 total points
ID: 20415164
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.

HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.

HWND_TOP
Places the window at the top of the Z order.

HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question