SW_MAXIMIZE; task bar;

Windows specific forum
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

SW_MAXIMIZE; task bar;

Post by HanPBF »

Hello!

How can I use SW_maximize without hiding the taskbar?

I need to do:

Code: Select all

ShowWindow_(WindowID(PB), #SW_MAXIMIZE)
to later be able to call:

Code: Select all

ShowWindow_(WindowID(PB), #SW_NORMAL)
If I would resize the window, #SW_NORMAL would let it as it is, of course.

What would be the correct way to maximize the window ot desktop height minus taskbar height?to

Really apreciate any info!
Thanks in advance,
regards!
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: SW_MAXIMIZE; task bar;

Post by RSBasic »

Why not SetWindowState() and #PB_Window_Maximize?
Image
Image
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: SW_MAXIMIZE; task bar;

Post by chi »

Just add #PB_Window_SizeGadget to your window... Only sizeable windows can maximize without hiding the taskbar!
Et cetera is my worst enemy
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: SW_MAXIMIZE; task bar;

Post by HanPBF »

Hello RSBasic,

is the same effect; I forgot to say I use #PB_Window_BorderLess.

Hello chi,

with #PB_Window_BorderLess | #PB_Window_SizeGadget normal border is shown again...
But thanks for the hint!

I will use a workaround with a stored pseudo-normal-size and restore to that.

Thanks both of You for Your help!!!
User avatar
Bisonte
Addict
Addict
Posts: 1320
Joined: Tue Oct 09, 2007 2:15 am

Re: SW_MAXIMIZE; task bar;

Post by Bisonte »

Another way on windows : Read the position and the size of the taskbar and make the resizing on your own... (cause of borderless window)
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4997
Joined: Sun Apr 12, 2009 6:27 am

Re: SW_MAXIMIZE; task bar;

Post by RASHAD »

Hi

Code: Select all


Global Maxx,WX,WY,WW,WH

Procedure WndProc(hwnd, uMsg, wParam, lParam)
 result = #PB_ProcessPureBasicEvents 
 Select uMsg 
    Case #WM_SIZE,#WM_MOVE
        ResizeGadget(0,#PB_Ignore,WindowHeight(0)-50,#PB_Ignore,#PB_Ignore)
        
    Case #WM_SETTINGCHANGE;,#WM_PAINT
        If Maxx = 1
          SystemParametersInfo_(#SPI_GETWORKAREA, 0, r.RECT, 0)
          MoveWindow_(WindowID(0),r\left,r\top,r\right-r\left,r\bottom-r\top,1)
        ElseIf Maxx = 2
          MoveWindow_(WindowID(0),WX,WY,WW,WH,1)
        EndIf
   EndSelect   
  ProcedureReturn result 
EndProcedure

If OpenWindow (0,0,0,400,300, "Borderless Window" , #PB_Window_BorderLess|#PB_Window_ScreenCentered )   
   SetWindowColor(0,$A0EFF9)
   ContainerGadget(0,10,255,120,40)
    SetGadgetColor(0,#PB_Gadget_BackColor,$A0EFF9)
    ButtonGadget(1,0,0,60,20,"Max")  
    ButtonGadget(2,0,20,60,20,"Restore")
    ButtonGadget(3,60,20,60,20,"Quit")
   CloseGadgetList()
    
   SetWindowCallback(@WndProc())
   Repeat
      Select  WaitWindowEvent() 
          Case #PB_Event_Gadget 
            Select EventGadget()
              Case 1
                Maxx = 1
                WX = WindowX(0)
                WY = WindowY(0)
                WW = WindowWidth(0)
                WH = WindowHeight(0)
                SystemParametersInfo_(#SPI_GETWORKAREA,0,r.RECT,0)                                                         
                MoveWindow_(WindowID(0),r\left,r\top,r\right-r\left,r\bottom-r\top,1)
                  
              Case 2
                Maxx = 2
                MoveWindow_(WindowID(0),WX,WY,WW,WH,1)
                                
              Case 3
                Quit = 1
                 
            EndSelect
               
          Case #WM_LBUTTONDOWN
              GetCursorPos_ (p.POINT)
              If WindowFromPoint_(p\y << 32 + p\x) = WindowID(0)
                   SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
              EndIf
                  
      EndSelect
   Until Quit = 1
EndIf
Egypt my love
Post Reply