Link to home
Start Free TrialLog in
Avatar of Bhawin
Bhawin

asked on

always on top form?

how can i create form which is displaied always on top
no other application can not hide any part of this form

like winamp and winzip
ASKER CERTIFIED SOLUTION
Avatar of marconovaro
marconovaro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Chong
See this:
Creating a 'Topmost' Window:
http://www.mvps.org/vbnet/faq/main/topmost.htm

cheers
Avatar of Lasseman
Lasseman

Hi there!

The API-call 'SetWindowPos' can take care of this for you.

This function is declared as follows:

Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

What you do here is send the handle to the form (its hwnd property) to the function and along with the constant HWND_TOPMOST for the hWndInsertAfter parameter.

Const HWND_TOPMOST = -1

The x, y, cx and cy values takes care of positioning and sizing, respectively. wFlags handles flags for positioning and resizing. For instance, the constant:

Const SWP_SHOWWINDOW = &H40

merely shows the window. The constant

Const SWP_NOSIZE = &H1

ignores the values of cx and cy, and keeps the original size of the window.

Enjoy

//Lasseman

Hi Bhawin,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept marconovaro's comment(s) as an answer.

Bhawin, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.

Netminder
EE Admin