|
-
Feb 27th, 2009, 03:29 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to check if window is on top?
How to check if window is on top?
-
Feb 27th, 2009, 03:39 PM
#2
Re: How to check if window is on top?
To check if a window is On Top use GetWindowLong with GWL_EXSTYLE and check the WS_EX_TOPMOST bit.
Code:
Dim lStyle As Long
lStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
if lStyle And WS_EX_TOPMOST Then '~~> Then it's on top
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 27th, 2009, 03:47 PM
#3
Thread Starter
Hyperactive Member
Re: How to check if window is on top?
It always returns zero.
-
Feb 27th, 2009, 03:49 PM
#4
Re: How to check if window is on top?
Just gotta ask. Did you use the following constants:
Private Const WS_EX_TOPMOST As Long = &H8&
Private Const GWL_EXSTYLE As Long = -20
Also, GetForegroundWindow will tell you which window currently is active. Not sure exactly what you mean by "on top"
-
Feb 27th, 2009, 04:15 PM
#5
Thread Starter
Hyperactive Member
Re: How to check if window is on top?
 Originally Posted by LaVolpe
Just gotta ask. Did you use the following constants:
Private Const WS_EX_TOPMOST As Long = &H8&
Private Const GWL_EXSTYLE As Long = -20
Yes, but it still returns zero.
Anyway I'll use GetForegroundWindow, thanks!
-
Feb 27th, 2009, 04:30 PM
#6
Re: [RESOLVED] How to check if window is on top?
You're welcome, but koolsid's reply was appropriate also. One solution checks for which window is the active one (has keyboard and mouse focus) while the other checks to see if the window has the "always on top" attribute set. The only confusion was in how each of us interpreted your "on top" meaning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|