Sver
Full Member
Posts: 145
|
Post by Sver on Nov 20, 2023 2:25:27 GMT -5
nomainwin
button #test.1, "Close window", [quit], UL, 10, 40 statictext #test.2, "This window will go in front in 10 seconds", 10, 10, 200, 20
open "Test" for window as #test #test "trapclose [quit]" '#test.1, "!hide"
s=10:timer 1000,[Proceed1]:wait
[Proceed1] timer 0 s=s-1
#test.2, "This window will go in front in ";s;" seconds" if s>0 then timer 1000,[Proceed1]:wait timer 0
'This brings the window in front of anything - however, it makes it stay in front. hPrinc = hwnd(#test) flags = _SWP_NOMOVE or _SWP_NOSIZE zorder= _HWND_TOPMOST gosub[SetWindowZorder]
'This brings the window back to normal so other things can get in front of it 'while remaining in front (However, the window does not have the FOCUS) '(Notice though, peculiarly; the other thing does not go in front until on mouse-button-UP);
hPrinc = hwnd(#test) flags = _SWP_NOMOVE or _SWP_NOSIZE zorder= _HWND_NOTOPMOST gosub[SetWindowZorder]
timer 1500,[Proceed2]:wait [Proceed2] timer 0
'This does NOT make the window gain focus...
#test.1, "!setfocus" #test.2, "Button was given focus!"
wait
[SetWindowZorder] calldll #user32, "SetWindowPos", _ hPrinc as Ulong,_ zorder as Long,_ 'set window at the bottom of Z order 0 as Long, _ 0 as Long,_ 0 as Long,_ 0 as Long, _ flags as Long,_ r as Long return
[quit] timer 0 close #test end
'Source: http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx '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.
|
|
|
Post by xxgeek on Nov 20, 2023 14:57:15 GMT -5
I know I'll be using this someday, already had a use for it in previous endeavors where a window was losing it's focus.
Thanks for posting and saving me the time Sver.
|
|
Sver
Full Member
Posts: 145
|
Post by Sver on Nov 25, 2023 5:21:57 GMT -5
|
|