Solved

Equivalent to setting TopMost = false

Posted on 2007-12-05
2
519 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now