Page 1 of 1
Always on bottom?
Posted: Tue Mar 08, 2005 3:51 pm
by Kazmirzak
Hy,
Everybody knows how to set a window to "always on top". Do you know a way to get a window to "always on bottom?". Maybe there is a small check the window can do to find out if another window opened behind it?
Posted: Tue Mar 08, 2005 4:41 pm
by dagcrack
From the newbies faq at beginners section:
Always on top:
Code: Select all
SetWindowPos_(WindowID(),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
Always on bottom:
Code: Select all
SetParent_(WindowID(),GetWindow_(FindWindow_(0,"Program Manager"),#GW_CHILD))
USE THE SEARCH BUTTON ALREADY!!

Posted: Sun Mar 20, 2005 10:55 am
by Kazmirzak
Thank you for your answer! I will try this out.
But please stop this "

Use the SEARCH button". I DID USE the search button - but this button brought nearly every single thread when typing "always on bottom" - I could search the forum by hand and would be quicker - you know I even tried this!
Anyway the newbies faq could be worth a visit.
Posted: Sun Mar 20, 2005 11:09 am
by thefool
of course if you dont know how to search you have a problem
tick the "Search for all terms" when you search or you will get a very big bunch of posts. Using the "Search for all terms" you search for the whole string instead of every word.

Posted: Sun Mar 20, 2005 11:17 am
by PB
> tick the "Search for all terms" when you search
Yes, this is in the FAQ too, and it's even in
red to highlight it.

Doing this found only 44 matches for "always on bottom".

Posted: Tue Mar 22, 2005 11:44 am
by Kazmirzak
Hello!
Yes, you are right, you can find this in the newbes faq.
I tried this piece of code and this really works - the window is never above another window.
But there ist still a problem: Sometimes my application window disappears - (it didn't that before) - the task manager still shows the application, but it is simply not visible anymore! Could it be that my window is now 'behind' the desktop environment? I think so because this problem also matters if I change the background image of the desktop - suddenly my app disappears!
Posted: Tue Mar 22, 2005 12:07 pm
by PB
> if I change the background image of the desktop - suddenly my app disappears
Hmm, I couldn't do this with XP -- the app was still visible. Got some code
that demonstrates the problem? And I'll need your version of Windows.
Posted: Tue Mar 22, 2005 1:43 pm
by Kale
Kazmirzak wrote:Thank you for your answer! I will try this out.
But please stop this "

Use the SEARCH button". I DID USE the search button - but this button brought nearly every single thread when typing "always on bottom" - I could search the forum by hand and would be quicker - you know I even tried this!
Anyway the newbies faq could be worth a visit.
You really should read the newbie threads before posting questions, infact you should give the whole manual a read before asking because after all you are a PB newbie and thats what they are there for.

Posted: Fri Mar 25, 2005 2:46 pm
by Kazmirzak
I figured out that my app also disappears when I press the F5 Button when the desktop is active, what does a 'refresh' of the desktop. I use Windows 98B.
The shortest code to test this should look like this:
1. OpenWindow (blabla)
2. SetParent_(WindowID(),GetWindow_(FindWindow_(0,"Program Manager"),#GW_CHILD))
3. Progress the Events until Quit
Posted: Fri Mar 25, 2005 3:40 pm
by PB
Ah, I see what you mean... and I found the fix, you must do this instead:
Code: Select all
SetParent_(WindowID(),FindWindow_(0,"Program Manager"))
This works on all versions of Windows. The FAQ will be updated. Thanks for the bug report!

Posted: Sun Apr 03, 2005 2:18 pm
by Kazmirzak
No, PB this actually doesn't fix the problem.
I tried your code: SetParent_(WindowID(),FindWindow_(0,"Program Manager")) - works fine until somebody presses "Alt+Tab" - if only one other window is open - the application disappears.
Posted: Sun Apr 03, 2005 2:40 pm
by PB
I couldn't duplicate this on XP or 2000... can you provide some code that
demonstrates it, as well as the steps to make it happen? I'm thinking that
perhaps it's your video card? Not sure.
Posted: Sun Apr 03, 2005 3:05 pm
by Sparkie
Try one of these...
In the event loop...
Code: Select all
If OpenWindow(0, 100, 150, 300, 100, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar, "Test")
SetWindowPos_(WindowID(), #HWND_BOTTOM, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE | #SWP_SHOWWINDOW)
Repeat
event = WaitWindowEvent()
If GetForegroundWindow_() = WindowID()
SetWindowPos_(WindowID(), #HWND_BOTTOM, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE | #SWP_SHOWWINDOW)
EndIf
Until event = #PB_Event_CloseWindow
EndIf
In the WindowCallback... <-- This is the one I use
Code: Select all
Procedure myWindowCallback(hWnd, msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_WINDOWPOSCHANGING
*winPos.WINDOWPOS = lParam
*winPos\flags | #SWP_NOZORDER
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 100, 150, 300, 100, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar, "Test")
SetWindowPos_(WindowID(), #HWND_BOTTOM, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE | #SWP_SHOWWINDOW)
SetWindowCallback(@myWindowCallback())
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
Posted: Sun Apr 03, 2005 8:13 pm
by Kazmirzak
So now for PB: Turn off your debugger. Start this code. Close ALL windows but the "New Desktop Utility". Now click the "New desktop utility" window and then press Alt+Tab. The window disappears forever on Win XP.
The new two solutions are very good - the only bad thing is that they don't hide the icon in the Alt-Tab-Popup. But this can be solved, can't it?
;***********************code snippet showing the error***********
;window creation
OpenWindow(1,0,0,800,600,#PB_WINDOW_SYSTEMMENU | 0,"New Desktop") :CreateGadgetList(WindowID(1))
;super - line
SetParent_(WindowID(F1),FindWindow_(0,"Program Manager"))
;wait-line
Repeat
event=WaitWindowEvent()
Until event=#PB_EventCloseWindow
;***********************************************************
Posted: Sun Apr 03, 2005 8:16 pm
by Fred
yes, you can open your window with the #WS_POPUP flag and it should solve the icon problem