Page 1 of 1

SW_MAXIMIZE; task bar;

Posted: Tue Feb 09, 2016 4:16 pm
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!

Re: SW_MAXIMIZE; task bar;

Posted: Tue Feb 09, 2016 4:30 pm
by RSBasic
Why not SetWindowState() and #PB_Window_Maximize?

Re: SW_MAXIMIZE; task bar;

Posted: Tue Feb 09, 2016 5:02 pm
by chi
Just add #PB_Window_SizeGadget to your window... Only sizeable windows can maximize without hiding the taskbar!

Re: SW_MAXIMIZE; task bar;

Posted: Tue Feb 09, 2016 5:19 pm
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!!!

Re: SW_MAXIMIZE; task bar;

Posted: Tue Feb 09, 2016 8:00 pm
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)

Re: SW_MAXIMIZE; task bar;

Posted: Wed Feb 10, 2016 3:05 pm
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