Always on bottom?

Everything else that doesn't fall into one of the other PB categories.
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Always on bottom?

Post 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?
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post 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!!
:twisted:
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post by Kazmirzak »

Thank you for your answer! I will try this out.

But please stop this " :twisted: 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.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
:D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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". :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post 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!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Kazmirzak wrote:Thank you for your answer! I will try this out.

But please stop this " :twisted: 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. :)
--Kale

Image
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post 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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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! :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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 
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post 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
;***********************************************************
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

yes, you can open your window with the #WS_POPUP flag and it should solve the icon problem
Post Reply