#PB_Window_Maximize (dont want hide taskbar) !?

Just starting out? Need help? Post your questions and find answers here.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

#PB_Window_Maximize (dont want hide taskbar) !?

Post by va!n »

When open a window and using this flag for a windows app, it starts at maximized but it will be in front of the taskbar! Is there any way to maxmize the app at programstart but dont be in front nor behind the taskbar!? (hope you guys know what i mean!? ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

ok, i found a way ;) if someone know another way, please tell me, thx!

EDITED:
When starting this example, the window seems to be 2-3 pixel widther as it should !? (you can notice this on the CLOSE button and its white border on XP)

Code: Select all

GetWindowRect_(GetDesktopWindow_(),rect.rect)
Debug "Full-Screen"
Debug rect\left
Debug rect\top
Debug rect\right
Debug rect\bottom

SystemParametersInfo_(#SPI_GETWORKAREA,0,rect.rect,0)
Debug "Desktop-Area"
Debug rect\left
Debug rect\top
Debug rect\right
Debug rect\bottom

lWindowWidth  = rect\right
lWindowHeight = rect\bottom

OpenWindow(0,0,0,lwindowWidth, lWindowHeight,  #PB_Window_SystemMenu, "Maximize and dont hide Taskbar")

Repeat
  Select WaitWindowEvent()
     Case #PB_Event_CloseWindow
        quit = 1
  EndSelect
Until quit

End
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

ah, i thought it works... but now i see it does not really work as i need and thought :twisted:
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

You need to account for the window caption height as well. When you use width and height in OpenWindow(), you are setting the size of the window client area.

Code: Select all

captionH = GetSystemMetrics_(#SM_CYCAPTION)

SystemParametersInfo_(#SPI_GETWORKAREA, 0, winRect.RECT, 0) 

WinWidth  = winRect\right - winRect\left - 10
WinHeight = winRect\bottom - winRect\top - captionH - 10

If OpenWindow(0, 0, 0, WinWidth, WinHeight,  #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_Maximize | #PB_Window_SizeGadget | #PB_Window_SystemMenu, "Maximize and dont hide Taskbar") And CreateGadgetList(WindowID(0))
  CreateStatusBar(0, WindowID(0))
  StatusBarText(0, 0, "Can you see this statusbar and the taskbar?")
  Repeat 
    Select WaitWindowEvent() 
      Case #PB_Event_CloseWindow 
        quit = 1 
    EndSelect 
  Until quit 
EndIf
End
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

Interesting. How come PB applications using #PB_Window_Maximize don't maximize up to the task bar automatically, like all other apps do?
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

I was curious about that myself and I SWEAR the first couple of time I tried, it wouldn't size to fit. Trying it once again, I see it does indeed size itself to fit. Hmmmm...need to go back and see where I went wrong the first time.

Thanks for waking me up USCode ;)

Everyone can just ignore my code above :oops:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@Sparkie
Thanks for helping... btw, i dont know if its a bug or a feature to maximize the full screen (hinding taskbar)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

OK, I see where I confused myself. My first attempts were to open the window to its maximized size without using the #PB_Window_Maximize flag. In other words the window was not actually maximized but yet sized nearly equal to it's maximized state. I then combined my various code and it was all fubar after that. :roll: Sorry for all the confusion. :(

On that note, I will say good night. :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

I may regret not going to bed but what the hell...

My taskbar remains visible here va!n. :?
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

@va!n:

Right click taskbar
Select Properties

Is Keep the taskbar on top of other windows checked :?:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

yes, sorry for confusing i.e. ! with your codesnip the widnow is maximized and the taskbar is still visible :)

when i talked about "its a bug or a feature (to hide the taskbar)", i mean the #MAXIMIZE flag from purebasic... but now i will go to bed too, good night ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

To maximize a window, it needs to have the MaximizeGadget flag. This is a Windows limitation.

Code: Select all

; Maximized
OpenWindow(0, 0, 0, 400, 300, #PB_Window_MaximizeGadget | #PB_Window_Maximize, "")

; Not maximized but covers the whole screen instead
; OpenWindow(0, 0, 0, 400, 300, #PB_Window_Maximize, "")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@Trond:
Thanks a lot for this tip! Now it works as wished :D
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
paleozord
User
User
Posts: 12
Joined: Wed Mar 15, 2006 8:30 pm

Post by paleozord »

When I try to run that code posted above:

Code: Select all

OpenWindow(0, 0, 0, 400, 300, #PB_Window_MaximizeGadget | #PB_Window_Maximize, "")
I get the error "Constant not found: #PB_Window_Maximize"

PB doesn't even recognize that that flag exists. What am I doing wrong?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

What version of PB are you running? Most of what gets posted these days is v4.0 beta code, I don't believe that flag exists in 3.94 or the demo version. For 3.94 you may need to maximize the window explicitly with:

Code: Select all

OpenWindow(0, 0, 0, 400, 300, #PB_Window_MaximizeGadget , "") 
ShowWindow_(WindowID(0),#SW_MAXIMIZE)
or you can use the equivalent windows flag:

Code: Select all

OpenWindow(0, 0, 0, 400, 300, #PB_Window_MaximizeGadget | #WS_MAXIMIZE , "") 
BERESHEIT
Post Reply