Solved

HOW TO KEEP A WINDOW ALWAYS ON TOP

Posted on 2004-04-16
5
3,672 Views
Last Modified: 2011-09-20
hey every1...

i need to keep a window always on top. it does not need to have the focus (recive keyboard and mouse input), but must be ontop.

if anyone knows how to do this (using win32 c++ code) then pls let me know.


thanks in advance,

suma
0
Comment
Question by:crip_walk_g
5 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10847556
0
 

Author Comment

by:crip_walk_g
ID: 10847776
i could not find any suitable code in that article.

the introduction was certainly about that topic, but when it got down to the actual source code it seemed to be about everything except keeping a window always on top...
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 390 total points
ID: 10847887
Use WS_EX_TOPMOST style. Window should be created with CreateWindowEx function, dwExStyle parameter should contain WS_EX_TOPMOST style.
To change extended style of existing window use SetWindowLong with GWL_EXSTYLE parameter.
0
 

Expert Comment

by:chiefsahab
ID: 10847905
Use bring windowtoTop Win32 API

The BringWindowToTop function brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated.

'This program needs two forms, two buttons and a module
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
''''''''''''''
'in form1
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
    'Set Form2 on top
    BringWindowToTop Form2.hwnd
End Sub
Private Sub Form_Load()
    Form2.Visible = True
End Sub
''''''''''''''
'in form2
Private Sub Command1_Click()
    'Set Form1 on top
    BringWindowToTop Form1.hwnd
End Sub
0
 

Author Comment

by:crip_walk_g
ID: 10848354
cheifsahab:

this function brings a window to the top, but does not keep it there.

AlexFM:

sweet... extremely simple, while completly effective

thanks y'all
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

21 Experts available now in Live!

Get 1:1 Help Now